Guten Morgen,
ich habe eine wahrscheinlich sehr einfach Frage für euch: Warum schlägt der folgende doctest fehl? Pythoncode: http://paste.pocoo.org/show/235359/ und Ausgabe: http://paste.pocoo.org/show/235358/
Wie man in der Ausgabe in den Zeilen 7 und 8 sieht, wurde aus dem \n ein "echter Zeilenumbruch" gemacht, wohingegen der \n in Zeile 10 so blieb.
Zeilenumbruch in doctest löst Fehler aus
Problem ist gelöst danke RTFM
Lösung: http://paste.pocoo.org/compare/235376/235359/
Edit: Cool, Links als Autor eines Zitats funktionieren tatsächlich. Sehr praktisch
Lösung: http://paste.pocoo.org/compare/235376/235359/
http://docs.python.org/library/doctest.html#how-are-docstring-examples-recognized hat geschrieben: If you continue a line via backslashing in an interactive session, or for any other reason use a backslash, you should use a raw docstring, which will preserve your backslashes exactly as you type them […] Otherwise, the backslash will be interpreted as part of the string. For example, the “\” above would be interpreted as a newline character. Alternatively, you can double each backslash in the doctest version (and not use a raw string)
Edit: Cool, Links als Autor eines Zitats funktionieren tatsächlich. Sehr praktisch