From 49d6b07c6b4b16d35f160726a59de819d077ee30 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 17 Aug 2006 21:11:47 +0000 Subject: Make the it_index field in the str/unicode iterators Py_ssize_t's. Test the new iterators on str/unicode. --- Lib/test/test_unicode.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Lib/test/test_unicode.py') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 34f9371658..517ecfddfe 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -93,6 +93,14 @@ class UnicodeTest( testrepr = repr(u''.join(map(unichr, xrange(256)))) self.assertEqual(testrepr, latin1repr) + def test_iterators(self): + # Make sure unicode objects have an __iter__ method + it = u"\u1111\u2222\u3333".__iter__() + self.assertEqual(it.next(), u"\u1111") + self.assertEqual(it.next(), u"\u2222") + self.assertEqual(it.next(), u"\u3333") + self.assertRaises(StopIteration, it.next) + def test_count(self): string_tests.CommonTest.test_count(self) # check mixed argument types -- cgit v1.2.1