[pypy-commit] pypy py3.5: Update test to match CPython 3.6, since we don't implement CPython 3.5's faulty behaviour (cf. http://bugs.python.org/issue26492 )

rlamy pypy.commits at gmail.com
Mon Dec 5 07:05:12 EST 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r88891:2430e096c6cb
Date: 2016-12-05 12:03 +0000
http://bitbucket.org/pypy/pypy/changeset/2430e096c6cb/

Log:	Update test to match CPython 3.6, since we don't implement CPython
	3.5's faulty behaviour (cf. http://bugs.python.org/issue26492 )

diff --git a/lib-python/3/test/test_array.py b/lib-python/3/test/test_array.py
--- a/lib-python/3/test/test_array.py
+++ b/lib-python/3/test/test_array.py
@@ -318,8 +318,21 @@
             d = pickle.dumps((itorig, orig), proto)
             it, a = pickle.loads(d)
             a.fromlist(data2)
-            self.assertEqual(type(it), type(itorig))
-            self.assertEqual(list(it), data2)
+            # PyPy change: we implement 3.6 behaviour
+            self.assertEqual(list(it), [])
+
+    def test_exhausted_iterator(self):
+        # PyPy change: test copied from 3.6 stdlib
+        a = array.array(self.typecode, self.example)
+        self.assertEqual(list(a), list(self.example))
+        exhit = iter(a)
+        empit = iter(a)
+        for x in exhit:  # exhaust the iterator
+            next(empit)  # not exhausted
+        a.append(self.outside)
+        self.assertEqual(list(exhit), [])
+        self.assertEqual(list(empit), [self.outside])
+        self.assertEqual(list(a), list(self.example) + [self.outside])
 
     def test_insert(self):
         a = array.array(self.typecode, self.example)


More information about the pypy-commit mailing list