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).
This commit is contained in:
David Röthlisberger 2019-07-11 09:57:44 +01:00
parent d5cc0f2a62
commit 4c590e002f
1 changed files with 4 additions and 2 deletions

View File

@ -956,7 +956,7 @@ class TestLiterals:
("3.1", "4.0"),
("8.22e5", "810000.0"),
# Only the actual output is rounded up, not the expected output:
("3.0", "2.99"),
("3.0", "2.98"),
("1e3", "999"),
],
)
@ -965,7 +965,9 @@ class TestLiterals:
test_doc="""
>>> {expression} #doctest: +NUMBER
{output}
"""
""".format(
expression=expression, output=output
)
)
reprec = testdir.inline_run()
reprec.assertoutcome(passed=0, failed=1)