Skip to content

Commit a897677

Browse files
committed
Added extra test for StringList
1 parent 4fe016d commit a897677

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tests/test_pretty_print.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from domdf_python_tools.pretty_print import FancyPrinter, simple_repr
2222
from domdf_python_tools.stringlist import StringList
2323

24-
2524
# list, tuple and dict subclasses that do or don't overwrite __repr__
2625

26+
2727
class list2(list):
2828
pass
2929

@@ -930,6 +930,7 @@ def format(self, object, context, maxlevels, level):
930930

931931

932932
def test_simple_repr(file_regression: FileRegressionFixture):
933+
933934
@simple_repr("a", "b", "c", "d", width=10)
934935
class F:
935936
a = "apple"

tests/test_pretty_print/test_simple_repr.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ F(
104104
98,
105105
99,
106106
]
107-
)
107+
)

tests/test_stringlist.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ def test_str(self):
408408
@pytest.mark.xfail()
409409
def test_pickle(self):
410410
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])
411-
assert sl == pickle.loads(pickle.dumps(sl)) # nosec: B301
411+
loaded = pickle.loads(pickle.dumps(sl)) # nosec: B301
412+
assert sl == loaded
413+
assert sl.indent == loaded.indent
414+
assert isinstance(loaded, StringList)
412415

413416

414417
class TestIndent:

0 commit comments

Comments
 (0)