joke2k / faker

Faker is a Python package that generates fake data for you.
https://faker.readthedocs.io
MIT License
17.69k stars 1.93k forks source link

TypeError: pystruct() got multiple values for keyword argument 'count' , what is the correct value_types? #366

Closed eromoe closed 2 years ago

eromoe commented 8 years ago

example doesn't show the value_types http://faker.readthedocs.io/en/master/providers/faker.providers.python.html

I want generate a ramdon json with all key and value is string. But only fake.pystruct(count=10) work

I look into the provider.python and find:

if not value_types:
    value_types = ['str', 'str', 'str', 'str', 'float', 'int', 'int', 'decimal', 'date_time', 'uri', 'email']

But still error

>>>value_types = ['str', 'str', 'str', 'str', 'float', 'int', 'int', 'decimal', 'date_time', 'uri', 'email']
>>>fake.pystruct(count=10, *value_types)
TypeError: pystruct() got multiple values for keyword argument 'count'

This fake.pystruct(10, 'str') work, you should change the doc with a correct

ThibaultLemaire commented 5 years ago

:+1: for documenting this. The valid values for value_types are nowhere documented.

My own testing yielded that you can pass built-in types (int, str, float, etc. without "") or names of providers (e.g. 'email')

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 14 days since being marked as stale.