Skip to content

Commit 185f1c0

Browse files
committed
Increase test coverage in stringlist module.
1 parent 4f8c306 commit 185f1c0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: tests/test_stringlist.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def test_setitem(self):
8282
sl[3:4] = "\nfoo\nbar\n", "baz"
8383
assert sl == ["foo", "bar", '', '', "foo", "bar", '', "baz", '', "world", '', '', '', "1234"]
8484

85+
sl[3:5] = iter(["foo", "bar", "baz"])
86+
assert sl == ["foo", "bar", '', "foo", "bar", "baz", '', "baz", '', "world", '', '', '', "1234"]
87+
8588
def test_blankline(self):
8689
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])
8790

@@ -563,8 +566,15 @@ def test_joinlines(string, lines):
563566

564567

565568
@no_type_check
566-
def test_textwrap_indent():
569+
def test_stringlist_textwrap_indent():
567570
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])
568571
assert textwrap.indent(sl, " ") == "\n\n hello\n world\n\n\n\n 1234\n"
569572
assert textwrap.indent(sl, '\t') == "\n\n\thello\n\tworld\n\n\n\n\t1234\n"
570573
assert textwrap.indent(sl, ">>> ") == "\n\n>>> hello\n>>> world\n\n\n\n>>> 1234\n"
574+
575+
576+
def test_stringlist_splitlines():
577+
sl = StringList(['', '', "hello", "world", '', '', '', "1234"])
578+
assert sl.splitlines() is sl
579+
assert list(sl.splitlines()) == ['', '', "hello", "world", '', '', '', "1234"]
580+
assert sl.splitlines(keepends=True) == ['\n', '\n', "hello\n", "world\n", '\n', '\n', '\n', "1234\n"]

0 commit comments

Comments
 (0)