| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
LGTM, thanks!
Sorry, something went wrong.
|
Hi @nicoddemus please have a look on the PR once. Thank you |
Sorry, something went wrong.
for more information, see https://pre-commit.ci
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Backport to 8.4.x: 💚 backport PR created✅ Backport PR branch: patchback/backports/8.4.x/111685cc506fbaf87c105e67d68fbd881a47a84b/pr-13543 Backported as #13555 🤖 @patchback |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fix #13530
Summary
This PR addresses a decimal.FloatOperation error that happens when calling repr() on a pytest.approx object created with a decimal.Decimal value. The error arises from comparing and formatting Decimal and float values without proper conversion, which activates the FloatOperation trap.
Changes
I modified the repr method to carefully handle Decimal and float attributes. This is done by explicitly converting float values to Decimal before comparisons and formatting.
I added checks for None to prevent invalid comparisons.
I avoided direct comparisons between float and Decimal that can lead to FloatOperation exceptions.
Testing
I created a minimal test to reproduce the FloatOperation error from pytest.approx(Decimal)'s repr().
The test passes after applying this fix, confirming that the issue is resolved.