MarketSquare / MarketSquare/robotframework-faker
Adding a custom provider fails with error: "set_formatter() takes exactly 3 arguments (2 given)"
- Dominant language
- HTML
- Stars
- 69
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
When I run the following code, I'm facing some difficulty. Calling the `Add Provider` keyword requires two arguments, instead of the expected 1: name of the module. This seems to me to be correct.
Assuming it might be the FakerLibrary I retrieved it's library instance and provided it to the keyword. Sadly this doesn't provide me with the desired end result but instead generates the error: "`FAIL : TypeError: set_formatter() takes exactly 3 arguments (2 given)`".
The Robot Script for this example.
```
*** Settings ***
Library FakerLibrary
*** Test Cases ***
Faker Custom Provider Generate Data
${fakerLib} Get Library Instance FakerLibrary
Add Provider ${fakerLib} OceanProvider
```
The custom provider Python code:
```
from faker.providers import BaseProvider
class OceanProvider(BaseProvider):
__provider__ = "ocean"
__lang__ = "en_US"
oceans = [
u'Atlantic', u'Pacific', u'Indian', u'Arctic', u'Southern',
]
@classmethod
def ocean(cls):
return cls.random_element(cls.oceans)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Robot Framework example in the issue and trace the Add Provider keyword, especially how it uses the FakerLibrary instance and OceanProvider. Reproduce the set_formatter() TypeError, then verify that the custom provider can be added with the documented one-module-name call and generate data successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100