Skip to content

Commit 4c590e0

Browse files
committed
Fix test_doctest.test_number_non_matches
These doctests were expected to fail, but they were failing because of a silly bug (I forgot to replace "{expression}" with the actual expression to be tested), not because of the thing they were meant to be testing. Then I had to fix one of the testcases because it was actually matching: >>> 3.0 #doctest: +NUMBER 2.99 The doctest is saying that the actual output should match to 2 decimal places, i.e. within 0.01 -- which it is, so it passes. I changed the expected output to 2.98 and now it doesn't match (as we expect).
1 parent d5cc0f2 commit 4c590e0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

testing/test_doctest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ def test_number_precision(self, testdir, config_mode):
956956
("3.1", "4.0"),
957957
("8.22e5", "810000.0"),
958958
# Only the actual output is rounded up, not the expected output:
959-
("3.0", "2.99"),
959+
("3.0", "2.98"),
960960
("1e3", "999"),
961961
],
962962
)
@@ -965,7 +965,9 @@ def test_number_non_matches(self, testdir, expression, output):
965965
test_doc="""
966966
>>> {expression} #doctest: +NUMBER
967967
{output}
968-
"""
968+
""".format(
969+
expression=expression, output=output
970+
)
969971
)
970972
reprec = testdir.inline_run()
971973
reprec.assertoutcome(passed=0, failed=1)

0 commit comments

Comments
 (0)