diff options
author | Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> | 2024-03-27 14:46:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 14:46:35 (GMT) |
commit | ce00de4c8cd39816f992e749c1074487d93abe9d (patch) | |
tree | f7d4606de7b2f01311bd43aa955f5f89981277b2 /Lib/test/test_doctest | |
parent | 92397d5ead38dde4154e70d00f24973bcf2a925a (diff) | |
download | cpython-ce00de4c8cd39816f992e749c1074487d93abe9d.zip cpython-ce00de4c8cd39816f992e749c1074487d93abe9d.tar.gz cpython-ce00de4c8cd39816f992e749c1074487d93abe9d.tar.bz2 |
gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items" (#117228)
Diffstat (limited to 'Lib/test/test_doctest')
-rw-r--r-- | Lib/test/test_doctest/test_doctest.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py index 43be200..3e883c5 100644 --- a/Lib/test/test_doctest/test_doctest.py +++ b/Lib/test/test_doctest/test_doctest.py @@ -2628,9 +2628,9 @@ We don't want `-v` in sys.argv for these tests. ... NameError: name 'favorite_color' is not defined ********************************************************************** - 1 items had failures: + 1 item had failures: 1 of 2 in test_doctest.txt - ***Test Failed*** 1 failures. + ***Test Failed*** 1 failure. TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. @@ -2657,9 +2657,9 @@ Globals may be specified with the `globs` and `extraglobs` parameters: Got: 'red' ********************************************************************** - 1 items had failures: + 1 item had failures: 1 of 2 in test_doctest.txt - ***Test Failed*** 1 failures. + ***Test Failed*** 1 failure. TestResults(failed=1, attempted=2) >>> doctest.master = None # Reset master. @@ -2689,10 +2689,10 @@ Verbosity can be increased with the optional `verbose` parameter: <BLANKLINE> b ok - 1 items passed all tests: + 1 item passed all tests: 2 tests in test_doctest.txt - 2 tests in 1 items. - 2 passed and 0 failed. + 2 tests in 1 item. + 2 passed. Test passed. TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. @@ -2749,7 +2749,7 @@ using the optional keyword argument `encoding`: ********************************************************************** ... ********************************************************************** - 1 items had failures: + 1 item had failures: 2 of 2 in test_doctest4.txt ***Test Failed*** 2 failures. TestResults(failed=2, attempted=2) @@ -2772,10 +2772,10 @@ Test the verbose output: Expecting: 'b\u0105r' ok - 1 items passed all tests: + 1 item passed all tests: 2 tests in test_doctest4.txt - 2 tests in 1 items. - 2 passed and 0 failed. + 2 tests in 1 item. + 2 passed. Test passed. TestResults(failed=0, attempted=2) >>> doctest.master = None # Reset master. @@ -2997,10 +2997,10 @@ With the verbose flag, we should see the test output, but no error output: Expecting: 'a' ok - 1 items passed all tests: + 1 item passed all tests: 2 tests in myfile.doc - 2 tests in 1 items. - 2 passed and 0 failed. + 2 tests in 1 item. + 2 passed. Test passed. Now we'll write a couple files, one with three tests, the other a python module @@ -3074,7 +3074,7 @@ not stderr: Got: 'ajkml' ********************************************************************** - 1 items had failures: + 1 item had failures: 2 of 3 in myfile.doc ***Test Failed*** 2 failures. @@ -3101,9 +3101,9 @@ The fourth run uses FAIL_FAST, so we should see only one error: Got: 'abcdef' ********************************************************************** - 1 items had failures: + 1 item had failures: 1 of 2 in myfile.doc - ***Test Failed*** 1 failures. + ***Test Failed*** 1 failure. The fifth test uses verbose with the two options, so we should get verbose success output for the tests in both files: @@ -3126,10 +3126,10 @@ success output for the tests in both files: Expecting: 'a...l' ok - 1 items passed all tests: + 1 item passed all tests: 3 tests in myfile.doc - 3 tests in 1 items. - 3 passed and 0 failed. + 3 tests in 1 item. + 3 passed. Test passed. Trying: 1 + 1 @@ -3141,12 +3141,12 @@ success output for the tests in both files: Expecting: 'abc def' ok - 1 items had no tests: + 1 item had no tests: myfile2 - 1 items passed all tests: + 1 item passed all tests: 2 tests in myfile2.test_func 2 tests in 2 items. - 2 passed and 0 failed. + 2 passed. Test passed. We should also check some typical error cases. |