summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-12-09 13:09:14 (GMT)
committerGitHub <noreply@github.com>2019-12-09 13:09:14 (GMT)
commit0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3 (patch)
tree2b0d2377452d9be8d09b46f38fffbceb4692110d /Lib/test
parenta1838ec2592e5082c75c77888f2a7a3eb21133e5 (diff)
downloadcpython-0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3.zip
cpython-0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3.tar.gz
cpython-0131aba5ae20d704b972ecd2ef0fc6c9e370a1b3.tar.bz2
bpo-38916: array.array: remove fromstring() and tostring() (GH-17487)
array.array: Remove tostring() and fromstring() methods. They were aliases to tobytes() and frombytes(), deprecated since Python 3.2.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_array.py20
1 files changed, 0 insertions, 20 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index c243957..5f612fb 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -426,26 +426,6 @@ class BaseTest:
b.fromlist(a.tolist())
self.assertEqual(a, b)
- def test_tofromstring(self):
- # Warnings not raised when arguments are incorrect as Argument Clinic
- # handles that before the warning can be raised.
- nb_warnings = 2
- with warnings.catch_warnings(record=True) as r:
- warnings.filterwarnings("always",
- message=r"(to|from)string\(\) is deprecated",
- category=DeprecationWarning)
- a = array.array(self.typecode, 2*self.example)
- b = array.array(self.typecode)
- self.assertRaises(TypeError, a.tostring, 42)
- self.assertRaises(TypeError, b.fromstring)
- self.assertRaises(TypeError, b.fromstring, 42)
- b.fromstring(a.tostring())
- self.assertEqual(a, b)
- if a.itemsize>1:
- self.assertRaises(ValueError, b.fromstring, "x")
- nb_warnings += 1
- self.assertEqual(len(r), nb_warnings)
-
def test_tofrombytes(self):
a = array.array(self.typecode, 2*self.example)
b = array.array(self.typecode)