Error when calling pyfloat provider
See original GitHub issue- Faker version: 2.0.4
- OS: Ubuntu 19.04
- Python version: 3.7.3
There is a bug in pyfloat
provider.
Steps to reproduce
from faker import Faker
fake = Faker()
# just any random float numbers in min_value < max_value
fake.pyfloat(min_value=-15.23, max_value=4512313)
Expected behavior
Above call should not raise any error.
Actual behavior
Running the code above will raise the following error:
....
File "/usr/lib/python3.7/random.py", line 186, in randrange
raise ValueError("non-integer arg 1 for randrange()")
ValueError: non-integer arg 1 for randrange()
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Obtaining wrong result when using PyFloat_FromDouble in a ...
I am in the process of learning how to call C functions from Python ... i); if(!PyFloat_Check(tupleItem)){ printf("Error: tuple contains a ...
Read more >PyValueError in pyo3::exceptions - Rust
Represents Python's ValueError exception. Example: Raising ValueError from Rust. This exception can be sent to Python code by converting it into a PyErr...
Read more >Floating Point Objects — Python 3.11.1 documentation
If pyfloat is not a Python floating point object but has a __float__() method, this method will first be called to convert pyfloat...
Read more >Faker - PyPI
Each call to method ``fake.name()`` yields a different (random) result. ... If no localized provider is found, the factory falls back to the...
Read more >The Python/C API
This method returns -1.0 upon failure, so one should call PyErr_Occurred() to check for errors. double PyFloat_AS_DOUBLE(PyObject *pyfloat).
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
Looks like we just went to 6.0.0, does this mean we can change the signature of this function and break compatibility?
I think @fcurella’s proposal to drop
left_digits
and changeright_digits
toprecision
makes the most sense. Then allowmin_value
andmax_value
to be floats.I can do the PR if you don’t have anything in the works yet, let me know.
This issue was closed because it has been inactive for 14 days since being marked as stale.