pydecimal provider with positive=True sometimes returns zero
See original GitHub issueFaker
version: 13.3.4- OS: Ubuntu 18.04.6
Call pydecimal
with positive=True
, and it’ll sometimes return a zero.
Steps to reproduce
Here’s an example:
import faker
f = faker.Faker()
are_zero = [f.pydecimal(positive=True, right_digits=0) == 0 for _ in range(1000)]
print(any(are_zero))
Expected behavior
It should always print False
.
Actual behavior
Sometimes it’s True
with f.pydecimal()
returning zero.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Error when calling pyfloat provider · Issue #1068 · joke2k/faker
I try to dynamically call these methods and I cannot provide the proper argument's type. New method signature: def pydecimal(self, left_digits: int=None, ...
Read more >faker.providers.python — Faker 15.3.4 documentation
Returns a random enum of the provided input Enum type. Parameters: enum_cls – The Enum type to produce the value for. Returns: A...
Read more >pydecimal provider with positive=True sometimes returns zero issue ...
Faker version: 13.3.4; OS: Ubuntu 18.04.6. Call pydecimal with positive=True , and it'll sometimes return a zero. Steps to reproduce. Here's an example:...
Read more >faker Changelog - PyUp.io
Improve randomness of ``pydecimal`` for different scenarios. ... 6.0.0. * Fix ``pyfloat`` returning zeros when positive=True. Thanks sciencectn.
Read more >faker - bytemeta
pydecimal provider with positive=True sometimes returns zero · Add `es_CL` providers · Faker produces different results when using pytest even with seed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Tayum Thanks, I wasn’t aware of
Decimal.next_plus()
.@jhbuhrman I agree with everything you said.
pydecimal
needs be locale-aware, which means we’ll need an additionalpython
provider fornl_BE
andfr_BE
, at least.In the docs, we’ll also have to mention that the meaning of
positive
is locale-dependent. I don’t think most people realize that.This issue was closed because it has been inactive for 14 days since being marked as stale.