lk-geimfari/mimesis

Generating dummy country data with mimesis only returns 'United States'

rgoubet opened this issue · 8 comments

Bug report

What's wrong

Address.country appears to return only United States:

from mimesis import Address

g = Address()
for i in range(0,11):
    print(g.country())

This returns 10 times United States. This is unlike:

g = Address()
for i in range(0,6):
    print(g.city())

Which returns 5 different city names.

How is that should be

I should get 5 different country names (in English).

System information

3.11.3 | packaged by conda-forge | (main, Apr 6 2023, 08:50:54) [MSC v.1934 64 bit (AMD64)]
Mimesis 7.1.0

You have to pass allow_random=True, like this:

address.country(allow_random=True)

See: https://mimesis.name/en/master/api.html#mimesis.Address.country

I'm going to change this behavior in upcoming release, to make country() return random country each time.

Great, thank you!

I've fixed this behavior.

There are two methods now:

country() always returns random country
default_country() always returns country associated with current locale i.e United States for en, Россия for ru

I will release 8.0.0 later this month.

I've fixed this one in 8.0.0 which is already available on PyPi, btw.

Yes, it was even available in Conda Forge on the same day. Tested and loving it. Thanks for your blazing-fast resolution!

@rgoubet You're welcome! Thank you for your interest!