mimesis: Seed does not work for some providers

Description: Seems like @duckyou have found a bug in our code and seed is really does not work sometime and we should fix it.

Reason: It’s happening because we use custom_code which use another random object.

Decision: We should move utils which use random to helpers.Random

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (30 by maintainers)

Most upvoted comments

@lk-geimfari im in! ^^

Seems like builtins providers also does not support of seed. We should fix it!

@duckyou We need to take a decision that will allow us to make the minimum number of changes.

@duckyou Let’s will weigh the pros and cons of all solutions.

@lk-geimfari I see here several solutions:

  1. Just pass random object to method
  2. Like you say here https://github.com/lk-geimfari/mimesis/issues/325#issuecomment-353350713
  3. Init random object in ValidateEnumMixin
  4. Just in provider method validate enum and raise exception

@duckyou I’ll wait for your PR. Keep in mind that we have builtins data providers and that sometimes we need an item of the enum, but not a value (personla.py -> surname, payment.py -> credit_card_number).

@duckyou I have invited you to @mimesis-lab. Accept the invitation if you’re interested. Thanks!

Fixed. Now we should think about how should we test providers with seed.

@duckyou Skip this for now. I’ll think about it later. Our priority for a right now is custom_code.

@lk-geimfari Hmm… You goddamn right! That’s may be simplest solution ☺️

I do this 😉

@duckyou You know, it’s better to move it to helpers.Random. There’s just everything related to random selection.