@@ -30,6 +30,7 @@ MAR_V: MaskedNDArray[np.void]
30
30
MAR_subclass : MaskedNDArraySubclass
31
31
32
32
MAR_1d : np .ma .MaskedArray [tuple [int ], np .dtype ]
33
+ MAR_2d_f4 : np .ma .MaskedArray [tuple [int , int ], np .dtype [np .float32 ]]
33
34
34
35
b : np .bool
35
36
f4 : np .float32
@@ -282,6 +283,14 @@ assert_type(np.ma.allclose(AR_f4, MAR_f4), bool)
282
283
assert_type (np .ma .allclose (AR_f4 , MAR_f4 , masked_equal = False ), bool )
283
284
assert_type (np .ma .allclose (AR_f4 , MAR_f4 , rtol = .4 , atol = .3 ), bool )
284
285
286
+ assert_type (np .ma .getmask (MAR_f4 ), NDArray [np .bool ] | np .bool )
287
+ # PyRight detects this one correctly, but mypy doesn't:
288
+ # `Revealed type is "Union[numpy.ndarray[Any, Any], numpy.bool[Any]]"`
289
+ assert_type (np .ma .getmask (MAR_1d ), np .ndarray [tuple [int ], np .dtype [np .bool ]] | np .bool ) # type: ignore[assert-type]
290
+ assert_type (np .ma .getmask (MAR_2d_f4 ), np .ndarray [tuple [int , int ], np .dtype [np .bool ]] | np .bool )
291
+ assert_type (np .ma .getmask ([1 ,2 ]), NDArray [np .bool ] | np .bool )
292
+ assert_type (np .ma .getmask (np .int64 (1 )), np .bool )
293
+
285
294
assert_type (np .ma .is_mask (MAR_1d ), bool )
286
295
assert_type (np .ma .is_mask (AR_b ), bool )
287
296
0 commit comments