[pypy-svn] r10030 - pypy/dist/pypy/lib/test2
alex at codespeak.net
alex at codespeak.net
Mon Mar 21 23:20:53 CET 2005
Author: alex
Date: Mon Mar 21 23:20:52 2005
New Revision: 10030
Added:
pypy/dist/pypy/lib/test2/test_iter_extra.py
Log:
test that iter raises TypeError when called on a fake-iterator
Added: pypy/dist/pypy/lib/test2/test_iter_extra.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/test2/test_iter_extra.py Mon Mar 21 23:20:52 2005
@@ -0,0 +1,21 @@
+# -*- coding: iso-8859-1 -*-
+import unittest, test.test_support
+import pickle
+
+class FakeIterator(object):
+ def __init__(self, *a):
+ pass
+ def __iter__(self):
+ return self
+ # no next method -- which is why it's *fake*!
+
+class IterTest(unittest.TestCase):
+
+ def test_fakeiterator(self):
+ self.assertRaises(TypeError, iter, FakeIterator())
+
+def test_main():
+ test.test_support.run_unittest(IterTest)
+
+if __name__ == "__main__":
+ test_main()
More information about the Pypy-commit
mailing list