@@ -31,7 +31,7 @@ class ArraySubclassWithKwargs(array.array):
3131 def __init__ (self , typecode , newarg = None ):
3232 array .array .__init__ (self )
3333
34- typecodes = 'uwbBhHiIlLfdqQFDe '
34+ typecodes = 'uwbBhHiIlLfdqQe '
3535
3636class MiscTest (unittest .TestCase ):
3737
@@ -113,14 +113,10 @@ def __index__(self):
113113UTF16_BE = 19
114114UTF32_LE = 20
115115UTF32_BE = 21
116- IEEE_754_FLOAT_COMPLEX_LE = 22
117- IEEE_754_FLOAT_COMPLEX_BE = 23
118- IEEE_754_DOUBLE_COMPLEX_LE = 24
119- IEEE_754_DOUBLE_COMPLEX_BE = 25
120- IEEE_754_FLOAT16_LE = 26
121- IEEE_754_FLOAT16_BE = 27
116+ IEEE_754_FLOAT16_LE = 22
117+ IEEE_754_FLOAT16_BE = 23
122118
123- MACHINE_FORMAT_CODE_MAX = 27
119+ MACHINE_FORMAT_CODE_MAX = 23
124120
125121
126122class ArrayReconstructorTest (unittest .TestCase ):
@@ -147,7 +143,7 @@ def test_error(self):
147143 self .assertRaises (ValueError , array_reconstructor ,
148144 array .array , "b" , UNKNOWN_FORMAT , b"" )
149145 self .assertRaises (ValueError , array_reconstructor ,
150- array .array , "b" , MACHINE_FORMAT_CODE_MAX + 1 , b"" )
146+ array .array , "b" , 22 , b"" )
151147 self .assertRaises (ValueError , array_reconstructor ,
152148 array .array , "d" , 16 , b"a" )
153149
@@ -199,15 +195,7 @@ def test_numbers(self):
199195 (['d' ], IEEE_754_DOUBLE_LE , '<dddd' ,
200196 [9006104071832581.0 , float ('inf' ), float ('-inf' ), - 0.0 ]),
201197 (['d' ], IEEE_754_DOUBLE_BE , '>dddd' ,
202- [9006104071832581.0 , float ('inf' ), float ('-inf' ), - 0.0 ]),
203- (['F' ], IEEE_754_FLOAT_COMPLEX_LE , '<FFFF' ,
204- [16711938.0j , float ('inf' ), complex ('1-infj' ), - 0.0 ]),
205- (['F' ], IEEE_754_FLOAT_COMPLEX_BE , '>FFFF' ,
206- [16711938.0j , float ('inf' ), complex ('1-infj' ), - 0.0 ]),
207- (['D' ], IEEE_754_DOUBLE_COMPLEX_LE , '<DDDD' ,
208- [9006104071832581.0j , float ('inf' ), complex ('1-infj' ), - 0.0 ]),
209- (['D' ], IEEE_754_DOUBLE_COMPLEX_BE , '>DDDD' ,
210- [9006104071832581.0j , float ('inf' ), complex ('1-infj' ), - 0.0 ]),
198+ [9006104071832581.0 , float ('inf' ), float ('-inf' ), - 0.0 ])
211199 )
212200 for testcase in testcases :
213201 valid_typecodes , mformat_code , struct_fmt , values = testcase
@@ -295,7 +283,7 @@ def test_byteswap(self):
295283 example = self .example
296284 a = array .array (self .typecode , example )
297285 self .assertRaises (TypeError , a .byteswap , 42 )
298- if a .itemsize in (1 , 2 , 4 , 8 , 16 ):
286+ if a .itemsize in (1 , 2 , 4 , 8 ):
299287 b = array .array (self .typecode , example )
300288 b .byteswap ()
301289 if a .itemsize == 1 :
@@ -1541,54 +1529,6 @@ def test_byteswap(self):
15411529 b .byteswap ()
15421530 self .assertEqual (a , b )
15431531
1544- class CFPTest (NumberTest ):
1545- example = [- 42j , 0 , 42 + 1j , 1e5j , - 1e10 ]
1546- outside = 23
1547-
1548- def assertEntryEqual (self , entry1 , entry2 ):
1549- self .assertAlmostEqual (entry1 , entry2 )
1550-
1551- def test_cmp (self ):
1552- a = array .array (self .typecode , self .example )
1553- self .assertIs (a == 42 , False )
1554- self .assertIs (a != 42 , True )
1555-
1556- self .assertIs (a == a , True )
1557- self .assertIs (a != a , False )
1558- self .assertIs (a < a , False )
1559- self .assertIs (a <= a , True )
1560- self .assertIs (a > a , False )
1561- self .assertIs (a >= a , True )
1562-
1563- self .assertIs (a == 2 * a , False )
1564- self .assertIs (a != 2 * a , True )
1565- self .assertIs (a < 2 * a , True )
1566- self .assertIs (a <= 2 * a , True )
1567- self .assertIs (a > 2 * a , False )
1568- self .assertIs (a >= 2 * a , False )
1569-
1570- def test_nan (self ):
1571- a = array .array (self .typecode , [float ('nan' )])
1572- b = array .array (self .typecode , [float ('nan' )])
1573- self .assertIs (a != b , True )
1574- self .assertIs (a == b , False )
1575-
1576- def test_byteswap (self ):
1577- a = array .array (self .typecode , self .example )
1578- self .assertRaises (TypeError , a .byteswap , 42 )
1579- if a .itemsize in (1 , 2 , 4 , 8 ):
1580- b = array .array (self .typecode , self .example )
1581- b .byteswap ()
1582- if a .itemsize == 1 :
1583- self .assertEqual (a , b )
1584- else :
1585- # On alphas treating the byte swapped bit patterns as
1586- # floats/doubles results in floating-point exceptions
1587- # => compare the 8bit string values instead
1588- self .assertNotEqual (a .tobytes (), b .tobytes ())
1589- b .byteswap ()
1590- self .assertEqual (a , b )
1591-
15921532
15931533class HalfFloatTest (FPTest , unittest .TestCase ):
15941534 example = [- 42.0 , 0 , 42 , 1e2 , - 1e4 ]
@@ -1623,15 +1563,6 @@ def test_alloc_overflow(self):
16231563 self .fail ("Array of size > maxsize created - MemoryError expected" )
16241564
16251565
1626- class ComplexFloatTest (CFPTest , unittest .TestCase ):
1627- typecode = 'F'
1628- minitemsize = 8
1629-
1630- class ComplexDoubleTest (CFPTest , unittest .TestCase ):
1631- typecode = 'D'
1632- minitemsize = 16
1633-
1634-
16351566class LargeArrayTest (unittest .TestCase ):
16361567 typecode = 'b'
16371568
0 commit comments