mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-80480: Emit DeprecationWarning for array's 'u' type code (#95760)
This commit is contained in:
parent
3a314f7c3d
commit
cc879481e2
7 changed files with 48 additions and 10 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue