diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst index 9839c7ad4..b17327f62 100644 --- a/doc/en/doctest.rst +++ b/doc/en/doctest.rst @@ -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 diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 40b6d7ebb..4aac5432d 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -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):