From 4c590e002fc220ae27e9451a39990fdc452a93a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20R=C3=B6thlisberger?= Date: Thu, 11 Jul 2019 09:57:44 +0100 Subject: [PATCH] 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). --- testing/test_doctest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 678c61af1..40b6d7ebb 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -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)