cpython: e6050cd9e29e (original) (raw)

Mercurial > cpython

changeset 92764:e6050cd9e29e 3.4

#8473: Add tests that doctest uses universal newlines in testfile. Python3 does not have the bug covered by the issue. [#8473]

R David Murray rdmurray@bitdance.com
date Thu, 02 Oct 2014 22:42:42 -0400
parents 1e0156aef491
children 7d587fbd7d09 1745fd612d73
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 @@ -2613,6 +2613,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