@@ -1493,34 +1493,52 @@ def test_is_scalar_builtin_nonscalars(self):
1493
1493
assert not is_scalar (slice (None ))
1494
1494
assert not is_scalar (Ellipsis )
1495
1495
1496
- def test_is_scalar_numpy_array_scalars (self ):
1497
- assert is_scalar (np .int64 (1 ))
1498
- assert is_scalar (np .float64 (1.0 ))
1499
- assert is_scalar (np .int32 (1 ))
1500
- assert is_scalar (np .complex64 (2 ))
1501
- assert is_scalar (np .object_ ("foobar" ))
1502
- assert is_scalar (np .str_ ("foobar" ))
1503
- assert is_scalar (np .unicode_ ("foobar" ))
1504
- assert is_scalar (np .bytes_ (b"foobar" ))
1505
- assert is_scalar (np .datetime64 ("2014-01-01" ))
1506
- assert is_scalar (np .timedelta64 (1 , "h" ))
1507
-
1508
- def test_is_scalar_numpy_zerodim_arrays (self ):
1509
- for zerodim in [
1510
- np .array (1 ),
1511
- np .array ("foobar" ),
1512
- np .array (np .datetime64 ("2014-01-01" )),
1513
- np .array (np .timedelta64 (1 , "h" )),
1514
- np .array (np .datetime64 ("NaT" )),
1515
- ]:
1516
- assert not is_scalar (zerodim )
1517
- assert is_scalar (lib .item_from_zerodim (zerodim ))
1518
-
1496
+ @pytest .mark .parametrize ("start" , (
1497
+ np .int64 (1 ),
1498
+ np .float64 (1.0 ),
1499
+ np .int32 (1 ),
1500
+ np .complex64 (2 ),
1501
+ np .object_ ("foobar" ),
1502
+ np .str_ ("foobar" ),
1503
+ np .unicode_ ("foobar" ),
1504
+ np .bytes_ (b"foobar" ),
1505
+ np .datetime64 ("2014-01-01" ),
1506
+ np .timedelta64 (1 , "h" ),
1507
+ ))
1508
+ @pytest .mark .parametrize ("numpy_like" , (True , False ))
1509
+ def test_is_scalar_numpy_array_scalars (self , start , numpy_like ):
1510
+ if numpy_like :
1511
+ start = MockNumpyLikeArray (start )
1512
+
1513
+ assert is_scalar (start )
1514
+
1515
+ @pytest .mark .parametrize ("zerodim" , (
1516
+ np .array (1 ),
1517
+ np .array ("foobar" ),
1518
+ np .array (np .datetime64 ("2014-01-01" )),
1519
+ np .array (np .timedelta64 (1 , "h" )),
1520
+ np .array (np .datetime64 ("NaT" )),
1521
+ ))
1522
+ @pytest .mark .parametrize ("numpy_like" , (True , False ))
1523
+ def test_is_scalar_numpy_zerodim_arrays (self , zerodim , numpy_like ):
1524
+ if numpy_like :
1525
+ zerodim = MockNumpyLikeArray (zerodim )
1526
+
1527
+ assert not is_scalar (zerodim )
1528
+ assert is_scalar (lib .item_from_zerodim (zerodim ))
1529
+
1530
+ @pytest .mark .parametrize ("start" , (
1531
+ np .array ([]),
1532
+ np .array ([[]]),
1533
+ np .matrix ("1; 2" ),
1534
+ ))
1535
+ @pytest .mark .parametrize ("numpy_like" , (True , False ))
1519
1536
@pytest .mark .filterwarnings ("ignore::PendingDeprecationWarning" )
1520
- def test_is_scalar_numpy_arrays (self ):
1521
- assert not is_scalar (np .array ([]))
1522
- assert not is_scalar (np .array ([[]]))
1523
- assert not is_scalar (np .matrix ("1; 2" ))
1537
+ def test_is_scalar_numpy_arrays (self , start , numpy_like ):
1538
+ if numpy_like :
1539
+ start = MockNumpyLikeArray (start )
1540
+
1541
+ assert not is_scalar (start )
1524
1542
1525
1543
def test_is_scalar_pandas_scalars (self ):
1526
1544
assert is_scalar (Timestamp ("2014-01-01" ))
0 commit comments