New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to seed uuid4 #484
Comments
Thank you for the report, good catch! Would you mind submit a Pull Request? |
The same issue for I am working on a unit test for the seeding part. But there is another issue that needs a fix first. |
Make it possible to seed uuid4 property #484
reopened so I can close it when we have tests |
It was mentioned on Stack Overflow, but the patch doesn't guarantee that the generated UUID is version 4 (which is what |
@kevin-brown I do agree that this is not a valid uuid4. Nevertheless, the format is UUID (32 alphanumeric characters and four hyphens). So I don't think there is an issue. |
@J535D165 @kevin-brown the method is called That said, I"m still not sure if there is a way that we can fix it, or that we should. If python's |
It's not that Python's |
@kevin-brown Do you know how to make it valid? Is it correct that you can't see a difference between an (incorrect) UUID4 in Faker and a valid UUID4? |
That is not correct. And 15/16 times it will produce a UUID that is not version 4.
There are a total of 8 bits that must be set manually in order for it to be properly detected as a UUIDv4.
|
I think we should revert the pull request to return the original functionality for |
Let's revert it or use the version proposed by Kevin. But can you explain me what breaks? |
Kevins solution appears to work properly. @kevin-brown can you create a pull request, I don't see any currently to update this. |
Was this fixed? I'm not able to create deterministic UUIDs with Faker-4.17.1
|
The tests which were added in #1050 (and closed out this ticket) are still in the repo at faker/tests/providers/test_misc.py Lines 68 to 75 in 594d344
I don't use Faker anymore, but after looking at the code it looks like it should now work with seeding and properly return v4 UUIDs. |
I followed the link to the commit in #1050 and the tests were using |
It is not possible to seed the uuid4 property.
The solution is pretty much given in:
http://stackoverflow.com/questions/41186818/how-to-generate-a-random-uuid-which-is-reproducible-with-a-seed-in-python
The text was updated successfully, but these errors were encountered: