diff options
| author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2023-06-11 09:17:35 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-11 09:17:35 (GMT) |
| commit | cc879481e2ac29742ce191f4c6ed4bd85e5e11ba (patch) | |
| tree | ec351755d6df819ba80a6530dd822d16972c809a /Lib/test/test_buffer.py | |
| parent | 3a314f7c3df0dd7c37da7d12b827f169ee60e1ea (diff) | |
| download | cpython-cc879481e2ac29742ce191f4c6ed4bd85e5e11ba.zip cpython-cc879481e2ac29742ce191f4c6ed4bd85e5e11ba.tar.gz cpython-cc879481e2ac29742ce191f4c6ed4bd85e5e11ba.tar.bz2 | |
gh-80480: Emit DeprecationWarning for array's 'u' type code (#95760)
Diffstat (limited to 'Lib/test/test_buffer.py')
| -rw-r--r-- | Lib/test/test_buffer.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py index 94fc9d4..8d6902e 100644 --- a/Lib/test/test_buffer.py +++ b/Lib/test/test_buffer.py @@ -24,6 +24,7 @@ import warnings import sys, array, io, os from decimal import Decimal from fractions import Fraction +from test.support import warnings_helper try: from _testbuffer import * @@ -3217,12 +3218,6 @@ class TestBufferProtocol(unittest.TestCase): nd[0] = (-1, float('nan')) self.assertNotEqual(memoryview(nd), nd) - # Depends on issue #15625: the struct module does not understand 'u'. - a = array.array('u', 'xyz') - v = memoryview(a) - self.assertNotEqual(a, v) - self.assertNotEqual(v, a) - # Some ctypes format strings are unknown to the struct module. if ctypes: # format: "T{>l:x:>l:y:}" @@ -3236,6 +3231,15 @@ class TestBufferProtocol(unittest.TestCase): self.assertNotEqual(point, a) self.assertRaises(NotImplementedError, a.tolist) + @warnings_helper.ignore_warnings(category=DeprecationWarning) # gh-80480 array('u') + def test_memoryview_compare_special_cases_deprecated_u_type_code(self): + + # Depends on issue #15625: the struct module does not understand 'u'. + a = array.array('u', 'xyz') + v = memoryview(a) + self.assertNotEqual(a, v) + self.assertNotEqual(v, a) + def test_memoryview_compare_ndim_zero(self): nd1 = ndarray(1729, shape=[], format='@L') |
