docs: Document doctest +NUMBER limitation with strings

Also added an "xfail" testcase for the same.
This commit is contained in:
David Röthlisberger 2019-07-11 10:04:43 +01:00
parent 4c590e002f
commit a740ef2036
2 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,9 @@ pytest also introduces new options:
0.23300000000000001
``NUMBER`` also supports lists of floating-point numbers -- in fact, it
supports floating-point numbers appearing anywhere in the output.
matches floating-point numbers appearing anywhere in the output, even inside
a string! This means that it may not be appropriate to enable globally in
``doctest_optionflags`` in your configuration file.
Continue on failure

View File

@ -958,6 +958,9 @@ class TestLiterals:
# Only the actual output is rounded up, not the expected output:
("3.0", "2.98"),
("1e3", "999"),
# The current implementation doesn't understand that numbers inside
# strings shouldn't be treated as numbers:
pytest.param("'3.1416'", "'3.14'", marks=pytest.mark.xfail),
],
)
def test_number_non_matches(self, testdir, expression, output):