[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way Filip, you were told on the Stackoverflow page that the output was correct and that you were not using doctest correctly. Serhiy also hinted to you that you should check the output in the REPL and you falsely claimed that it gave the expected

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: Have you tried calling multiline_output() in the REPL? It does *not* show your expected output: # expected First line Second line but the string repr(): # actual 'First line\nSecond line\n' Change your doctest to either: >>>

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Filip Rembiałkowski
Filip Rembiałkowski added the comment: Actually, the behavior does not depend on leading spaces, and test case can be isolated even further. Sample is attached [doctest-bugs-2.py]. -- Added file: https://bugs.python.org/file49066/doctest-bugs-2.py

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Filip Rembiałkowski
Filip Rembiałkowski added the comment: @Serhiy, Thank you for feedback. Yes the "testme" function (indeed trivial) works as expected - both in interactive Python interpreter and in script file. If you go to Lib/doctest.py, search for "string-identical" and debug my example there, you will

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Did you try to run the tested function in the interactive Python interpreter? Did you get what you expected? -- nosy: +serhiy.storchaka ___ Python tracker

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Filip Rembiałkowski
New submission from Filip Rembiałkowski : The doctest module does not compare multiline strings properly, as attached example proves. Tested on 2.7, 3.6 and 3.9.0a5+. (platform: Ubuntu 18.04). Related: