diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-25 19:05:35 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-25 19:05:35 (GMT) |
commit | f9253c96fdff3ae1fcdacc72c06632f41df0424c (patch) | |
tree | 85e1a5bea8c837974ea404ac031894f85c4394bd /Lib/test/test_csv.py | |
parent | ef1585eb9a488ae8ce3ff057f43a7048b941cc1c (diff) | |
parent | f81be8aa3ff3cbae66686482219bd7c7561f3de8 (diff) | |
download | cpython-f9253c96fdff3ae1fcdacc72c06632f41df0424c.zip cpython-f9253c96fdff3ae1fcdacc72c06632f41df0424c.tar.gz cpython-f9253c96fdff3ae1fcdacc72c06632f41df0424c.tar.bz2 |
Issue #22995: Instances of extension types with a state that aren't
subclasses of list or dict and haven't implemented any pickle-related
methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__,
or __getstate__), can no longer be pickled. Including memoryview.
Diffstat (limited to 'Lib/test/test_csv.py')
-rw-r--r-- | Lib/test/test_csv.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 4763bbb..921fd4a 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -1,6 +1,7 @@ # Copyright (C) 2001,2002 Python Software Foundation # csv package unit tests +import copy import io import sys import os @@ -9,6 +10,7 @@ from io import StringIO from tempfile import TemporaryFile import csv import gc +import pickle from test import support class Test_Csv(unittest.TestCase): @@ -424,6 +426,17 @@ class TestDialectRegistry(unittest.TestCase): self.assertRaises(TypeError, csv.reader, [], quoting = -1) self.assertRaises(TypeError, csv.reader, [], quoting = 100) + def test_copy(self): + for name in csv.list_dialects(): + dialect = csv.get_dialect(name) + self.assertRaises(TypeError, copy.copy, dialect) + + def test_pickle(self): + for name in csv.list_dialects(): + dialect = csv.get_dialect(name) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + self.assertRaises(TypeError, pickle.dumps, dialect, proto) + class TestCsvBase(unittest.TestCase): def readerAssertEqual(self, input, expected_result): with TemporaryFile("w+", newline='') as fileobj: |