FactoryBoy / factory_boy

A test fixtures replacement for Python
https://factoryboy.readthedocs.io/
MIT License
3.48k stars 392 forks source link

Custom provider declaration example in add_provider documentation #352

Open buoto opened 7 years ago

buoto commented 7 years ago

Example https://factoryboy.readthedocs.io/en/latest/reference.html#factory.Faker.add_provider showing how to create SmileyProvider would be nice.

BTW where are sources for the docs? https://github.com/FactoryBoy/factory_boy/blob/master/docs/reference.rst don't have following section.

codersquid commented 7 years ago

I'd love to have some more examples on adding a custom providers as well because I'm having difficulty getting a custom provider to work.

I've been looking at factory_boy's faker wrapper to get a grip on how adding customer providers works, and I've also been looking at factory_boy's test_faker.py to follow the provider test cases. (I've also been going through faker's source code to see how their registry works).

berkerpeksag commented 6 years ago

I've opened #413 to implement SmileyProvider custom provider in the example. I hope I got the meaning of SmileyProvider right so please review it :)