Skip to content

Commit 7b51b5b

Browse files
committed
icecream v2.1.5; added tests for new way of printing strings
1 parent 2378a25 commit 7b51b5b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_icecream.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,32 @@ def testColoring(self):
616616
def testConfigureOutputWithNoParameters(self):
617617
with self.assertRaises(TypeError):
618618
ic.configureOutput()
619+
620+
def test_multiline_strings_output(self):
621+
622+
test1 = "A\\veryvery\\long\\path\\to\\no\\even\\longer\\HelloWorld _01_Heritisfinallythe file.file"
623+
test2 = r"A\veryvery\long\path\to\no\even\longer\HelloWorld _01_Heritisfinallythe file.file"
624+
test3 = "line\nline"
625+
626+
with disableColoring(), captureStandardStreams() as (_, err):
627+
ic(test1)
628+
curr_res = err.getvalue().strip()
629+
expected = r"ic| test1: 'A\\veryvery\\long\\path\\to\\no\\even\\longer\\HelloWorld _01_Heritisfinallythe file.file'"
630+
self.assertEqual(curr_res, expected)
631+
del curr_res, expected
632+
633+
with disableColoring(), captureStandardStreams() as (_, err):
634+
ic(test2)
635+
curr_res = err.getvalue().strip()
636+
# expected = r"ic| test2: 'A\\veryvery\\long\\path\\to\\no\\even\\longer\\HelloWorld _01_Heritisfinallythe file.file'"
637+
expected = r"ic| test2: 'A\\veryvery\\long\\path\\to\\no\\even\\longer\\HelloWorld _01_Heritisfinallythe file.file'"
638+
self.assertEqual(curr_res, expected)
639+
del curr_res, expected
640+
641+
with disableColoring(), captureStandardStreams() as (_, err):
642+
ic(test3)
643+
curr_res = err.getvalue().strip()
644+
expected = r"""ic| test3: '''line
645+
line'''"""
646+
self.assertEqual(curr_res, expected)
647+
del curr_res, expected

0 commit comments

Comments
 (0)