summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-17 21:11:47 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-17 21:11:47 (GMT)
commit49d6b07c6b4b16d35f160726a59de819d077ee30 (patch)
tree45686ed91cc46f46e206bb52a45d7c8abd3cf67b /Lib/test/test_unicode.py
parentbf12cdbb2880eb402f65ce8d1db09caa84c6b801 (diff)
downloadcpython-49d6b07c6b4b16d35f160726a59de819d077ee30.zip
cpython-49d6b07c6b4b16d35f160726a59de819d077ee30.tar.gz
cpython-49d6b07c6b4b16d35f160726a59de819d077ee30.tar.bz2
Make the it_index field in the str/unicode iterators Py_ssize_t's.
Test the new iterators on str/unicode.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 34f9371..517ecfd 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