@@ -82,6 +82,9 @@ def test_setitem(self):
8282 sl [3 :4 ] = "\n foo\n bar\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 \t hello\n \t world\n \n \n \n \t 1234\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