@@ -82,6 +82,9 @@ def test_setitem(self):
82
82
sl [3 :4 ] = "\n foo\n bar\n " , "baz"
83
83
assert sl == ["foo" , "bar" , '' , '' , "foo" , "bar" , '' , "baz" , '' , "world" , '' , '' , '' , "1234" ]
84
84
85
+ sl [3 :5 ] = iter (["foo" , "bar" , "baz" ])
86
+ assert sl == ["foo" , "bar" , '' , "foo" , "bar" , "baz" , '' , "baz" , '' , "world" , '' , '' , '' , "1234" ]
87
+
85
88
def test_blankline (self ):
86
89
sl = StringList (['' , '' , "hello" , "world" , '' , '' , '' , "1234" ])
87
90
@@ -563,8 +566,15 @@ def test_joinlines(string, lines):
563
566
564
567
565
568
@no_type_check
566
- def test_textwrap_indent ():
569
+ def test_stringlist_textwrap_indent ():
567
570
sl = StringList (['' , '' , "hello" , "world" , '' , '' , '' , "1234" ])
568
571
assert textwrap .indent (sl , " " ) == "\n \n hello\n world\n \n \n \n 1234\n "
569
572
assert textwrap .indent (sl , '\t ' ) == "\n \n \t hello\n \t world\n \n \n \n \t 1234\n "
570
573
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