diff options
author | Guido van Rossum <guido@python.org> | 2006-08-17 21:11:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-17 21:11:47 (GMT) |
commit | 49d6b07c6b4b16d35f160726a59de819d077ee30 (patch) | |
tree | 45686ed91cc46f46e206bb52a45d7c8abd3cf67b /Lib/test/test_str.py | |
parent | bf12cdbb2880eb402f65ce8d1db09caa84c6b801 (diff) | |
download | cpython-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_str.py')
-rw-r--r-- | Lib/test/test_str.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py index 45942a6..226a168 100644 --- a/Lib/test/test_str.py +++ b/Lib/test/test_str.py @@ -19,6 +19,14 @@ class StrTest( string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) self.assertRaises(OverflowError, '%c'.__mod__, 0x1234) + def test_iterators(self): + # Make sure str objects have an __iter__ method + it = "abc".__iter__() + self.assertEqual(it.next(), "a") + self.assertEqual(it.next(), "b") + self.assertEqual(it.next(), "c") + self.assertRaises(StopIteration, it.next) + def test_conversion(self): # Make sure __str__() behaves properly class Foo0: |