Last active
December 8, 2021 19:26
-
-
Save okken/d45ecedf3fcfdd8516e49ce8f5290f99 to your computer and use it in GitHub Desktop.
textwrap.dedent for testing example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textwrap import dedent | |
def multiline_hello_world(): | |
print("hello") | |
print(" world") | |
def test_multiline_hello_world(capsys): | |
expected = dedent('''\ | |
hello | |
world | |
''') | |
multiline_hello_world() | |
actual = capsys.readouterr().out | |
assert actual == expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment