cpython: 7d587fbd7d09 (original) (raw)
Mercurial > cpython
changeset 92765:7d587fbd7d09
Merge: #8473: Add tests that doctest uses universal newlines in testfile. [#8473]
R David Murray rdmurray@bitdance.com | |
---|---|
date | Thu, 02 Oct 2014 22:43:51 -0400 |
parents | b15c5a66213f(current diff)e6050cd9e29e(diff) |
children | 4f33a4a2b425 |
files | Lib/test/test_doctest.py |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_doctest.py 30 |
line wrap: on
line diff
--- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -2616,6 +2616,36 @@ Test the verbose output: >>> sys.argv = save_argv """ +def test_lineendings(): r""" +*nix systems use \n line endings, while Windows systems use \r\n. Python +handles this using universal newline mode for reading files. Let's make +sure doctest does so (issue 8473) by creating temporary test files using each +of the two line disciplines. One of the two will be the "wrong" one for the +platform the test is run on. + +Windows line endings first: +
+ +And now *nix line endings: +
+ +""" + def test_testmod(): r""" Tests for the testmod function. More might be useful, but for now we're just testing the case raised by Issue 6195, where trying to doctest a C module would