Open cornfeedhobo opened 2 weeks ago
Hello cornfeedhobo,
I was able to replicate the issue have above. Looking at how the code generates the values using a random generator method which is referencing the same country data. How ever I would question if using a random generator twice with the same seed would be the right approach. As once you have a known expected value (your generated country), it would make sense to reference the country code from the same country data it has been randomised from. Below is a snippet of code which does this.
from faker.proxy import Faker as f from faker.providers.date_time import Provider from faker.generator import Generator from faker.providers import BaseProvider g = Generator() b = BaseProvider(g) p = Provider(b)
f.seed(0) c = f().country() cc = [Country for Country in p.countries if Country.name == c] for each in cc: country_code = each.alpha_2_code
I hope this is useful for you.
When pulling things like
country()
, it would be useful if thecountry_code()
matched, but it currently doesn't.Expected behavior
Actual behavior