Skip to content

Commit 07e5961

Browse files
committed
Added new test for FancyPrinter
1 parent 90182ae commit 07e5961

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/test_pretty_print.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import itertools
1313
import random
1414
import types
15+
from textwrap import dedent
1516
from typing import no_type_check
1617

1718
# 3rd party
@@ -139,8 +140,42 @@ def __hash__(self):
139140
return self._hash
140141

141142

143+
fruit = [
144+
"apple",
145+
"orange",
146+
"pear",
147+
"lemon",
148+
"grape",
149+
"strawberry",
150+
"banana",
151+
"plum",
152+
"tomato",
153+
"cherry",
154+
"blackcurrant",
155+
]
156+
157+
142158
class TestFancyPrinter:
143159

160+
def test_list(self):
161+
assert FancyPrinter().pformat([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
162+
assert FancyPrinter().pformat(fruit) == dedent(
163+
"""\
164+
[
165+
'apple',
166+
'orange',
167+
'pear',
168+
'lemon',
169+
'grape',
170+
'strawberry',
171+
'banana',
172+
'plum',
173+
'tomato',
174+
'cherry',
175+
'blackcurrant',
176+
]"""
177+
)
178+
144179
@no_type_check
145180
def test_init(self):
146181
FancyPrinter()

0 commit comments

Comments
 (0)