@@ -1616,7 +1616,8 @@ def test_sort(self):
1616
1616
# of sorted items must be greater than ~50 to check the actual
1617
1617
# algorithm because quick and merge sort fall over to insertion
1618
1618
# sort for small arrays.
1619
- for dtype in [np .int32 , np .uint32 , np .float32 ]:
1619
+ # Test unsigned dtypes and nonnegative numbers
1620
+ for dtype in [np .uint8 , np .uint16 , np .uint32 , np .uint64 , np .float16 , np .float32 , np .float64 , np .longdouble ]:
1620
1621
a = np .arange (101 , dtype = dtype )
1621
1622
b = a [::- 1 ].copy ()
1622
1623
for kind in self .sort_kinds :
@@ -1628,6 +1629,19 @@ def test_sort(self):
1628
1629
c .sort (kind = kind )
1629
1630
assert_equal (c , a , msg )
1630
1631
1632
+ # Test signed dtypes and negative numbers as well
1633
+ for dtype in [np .int8 , np .int16 , np .int32 , np .int64 , np .float16 , np .float32 , np .float64 , np .longdouble ]:
1634
+ a = np .arange (- 50 , 51 , dtype = dtype )
1635
+ b = a [::- 1 ].copy ()
1636
+ for kind in self .sort_kinds :
1637
+ msg = "scalar sort, kind=%s, dtype=%s" % (kind , dtype )
1638
+ c = a .copy ()
1639
+ c .sort (kind = kind )
1640
+ assert_equal (c , a , msg )
1641
+ c = b .copy ()
1642
+ c .sort (kind = kind )
1643
+ assert_equal (c , a , msg )
1644
+
1631
1645
# test complex sorts. These use the same code as the scalars
1632
1646
# but the compare function differs.
1633
1647
ai = a * 1j + 1
0 commit comments