cpython: dfef42311c71 (original) (raw)

Mercurial > cpython

changeset 100424:dfef42311c71 3.5

Issue #26015: Added new tests for pickling iterators of mutable sequences. [#26015]

Serhiy Storchaka storchaka@gmail.com
date Sun, 06 Mar 2016 14:10:24 +0200
parents f3c54cbac3de
children be96b2784f73 52d7a308e3b4
files Lib/test/test_array.py Lib/test/test_bytes.py Lib/test/test_deque.py Lib/test/test_iter.py Lib/test/test_list.py Misc/NEWS
diffstat 6 files changed, 212 insertions(+), 46 deletions(-)[+] [-] Lib/test/test_array.py 45 Lib/test/test_bytes.py 42 Lib/test/test_deque.py 47 Lib/test/test_iter.py 36 Lib/test/test_list.py 86 Misc/NEWS 2

line wrap: on

line diff

--- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -284,19 +284,42 @@ class BaseTest: self.assertEqual(type(a), type(b)) def test_iterator_pickle(self):

+

+

def test_insert(self): a = array.array(self.typecode, self.example)

--- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -595,10 +595,9 @@ class BaseBytesTest: self.assertEqual(list(it), data) it = pickle.loads(d)

@@ -1284,6 +1283,43 @@ class ByteArrayTest(BaseBytesTest, unitt from _testcapi import getbuffer_with_null_view self.assertRaises(BufferError, getbuffer_with_null_view, bytearray())

+

+

+

+ + class AssortedBytesTest(unittest.TestCase): # # Test various combinations of bytes and bytearray

--- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -638,18 +638,45 @@ class TestBasic(unittest.TestCase):

self.assertEqual(id(e), id(e[-1]))

def test_iterator_pickle(self):

+

+

def test_deepcopy(self): mut = [10]

--- a/Lib/test/test_iter.py +++ b/Lib/test/test_iter.py @@ -153,6 +153,42 @@ class TestCase(unittest.TestCase): def test_seq_class_iter(self): self.check_iterator(iter(SequenceClass(10)), list(range(10)))

+

+

+

+ # Test a new_style class with iter but no next() method def test_new_style_iter_class(self): class IterClass(object):

--- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -72,34 +72,76 @@ class ListTest(list_tests.CommonTest): check(1000000) def test_iterator_pickle(self):

+

+

def test_reversed_pickle(self):

+

+

def test_no_comdat_folding(self): # Issue 8847: In the PGO build, the MSVC linker's COMDAT folding

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -274,6 +274,8 @@ Documentation Tests ----- +- Issue #26015: Added new tests for pickling iterators of mutable sequences. +