Skip to content

Commit ad2d676

Browse files
add some tests
1 parent c443507 commit ad2d676

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎Lib/test/test_unicode.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ def test_iterators(self):
185185
self.assertEqual(next(it), "\u3333")
186186
self.assertRaises(StopIteration, next, it)
187187

188+
def test_iterators_invocation(self):
189+
cases = [type(iter('abc')), type(iter('🚀'))]
190+
for cls in cases:
191+
with self.subTest(cls=cls):
192+
self.assertRaises(TypeError, cls)
193+
194+
def test_iteration(self):
195+
cases = ['abc', '🚀🚀🚀', "\u1111\u2222\u3333"]
196+
for case in cases:
197+
with self.subTest(string=case):
198+
self.assertEqual((*case,), (*iter(case),))
199+
188200
def test_count(self):
189201
string_tests.CommonTest.test_count(self)
190202
# check mixed argument types

0 commit comments

Comments
 (0)