-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve approx repr for better readability (#12665)
Adjust `ApproxScalar.__repr__` to format tolerances in decimal form for smaller ranges. Closes #6985 --------- Co-authored-by: Bruno Oliveira <[email protected]> Co-authored-by: Pierre Sassoulas <[email protected]>
- Loading branch information
1 parent
f0a0436
commit 5a01583
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Improved :func:`pytest.approx` to enhance the readability of value ranges and tolerances between 0.001 and 1000. | ||
* The `repr` method now provides clearer output for values within those ranges, making it easier to interpret the results. | ||
* Previously, the output for those ranges of values and tolerances was displayed in scientific notation (e.g., `42 ± 1.0e+00`). The updated method now presents the tolerance as a decimal for better readability (e.g., `42 ± 1`). | ||
|
||
Example: | ||
|
||
**Previous Output:** | ||
|
||
.. code-block:: console | ||
>>> pytest.approx(42, abs=1) | ||
42 ± 1.0e+00 | ||
**Current Output:** | ||
|
||
.. code-block:: console | ||
>>> pytest.approx(42, abs=1) | ||
42 ± 1 | ||
-- by :user:`fazeelghafoor` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters