docs: Document doctest +NUMBER limitation with strings
Also added an "xfail" testcase for the same.
This commit is contained in:
parent
4c590e002f
commit
a740ef2036
|
@ -152,7 +152,9 @@ pytest also introduces new options:
|
||||||
0.23300000000000001
|
0.23300000000000001
|
||||||
|
|
||||||
``NUMBER`` also supports lists of floating-point numbers -- in fact, it
|
``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
|
Continue on failure
|
||||||
|
|
|
@ -958,6 +958,9 @@ class TestLiterals:
|
||||||
# Only the actual output is rounded up, not the expected output:
|
# Only the actual output is rounded up, not the expected output:
|
||||||
("3.0", "2.98"),
|
("3.0", "2.98"),
|
||||||
("1e3", "999"),
|
("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):
|
def test_number_non_matches(self, testdir, expression, output):
|
||||||
|
|
Loading…
Reference in New Issue