@@ -857,6 +857,28 @@ def test_fam_array_get_all_j():
857857 assert fam .get_all (np .array (("bb" , "dd" , "bb" , "dd" ))).tolist () == [1 , 3 , 1 , 3 ]
858858
859859
860+ def test_fam_array_get_all_k1 ():
861+ a1 = np .array (("2023-01-05" , "1854-05-02" ), np .datetime64 )
862+ a1 .flags .writeable = False
863+ fam = FrozenAutoMap (a1 )
864+
865+ post = fam .get_all (
866+ np .array (["1854-05-02" , "2023-01-05" , "2023-01-05" ], np .datetime64 )
867+ )
868+ assert post .tolist () == [1 , 0 , 0 ]
869+
870+
871+ def test_fam_array_get_all_k2 ():
872+ a1 = np .array (("2023-01-05" , "1854-05-02" ), np .datetime64 )
873+ a1 .flags .writeable = False
874+ fam = FrozenAutoMap (a1 )
875+
876+ with pytest .raises (KeyError ):
877+ post = fam .get_all (
878+ np .array (["1854-05-02" , "2023-01-05" , "2020-01-05" ], np .datetime64 )
879+ )
880+
881+
860882# -------------------------------------------------------------------------------
861883
862884
@@ -901,3 +923,27 @@ def test_fam_array_get_any_b():
901923 assert post1 == list (fam .values ())
902924 assert a1 [0 ] in fam
903925 assert 4294967295 in fam
926+
927+
928+ def test_fam_array_get_any_c1 ():
929+ a1 = np .array (("2023-01-05" , "1854-05-02" ), np .datetime64 )
930+ a1 .flags .writeable = False
931+ fam = FrozenAutoMap (a1 )
932+
933+ post = fam .get_any (
934+ np .array (
935+ ["1854-05-02" , "nat" , "1854-05-02" , "2023-01-05" , "nat" ], np .datetime64
936+ )
937+ )
938+ assert post == [1 , 1 , 0 ]
939+
940+
941+ def test_fam_array_get_any_c2 ():
942+ a1 = np .array (("2023-01-05" , "1854-05-02" ), np .datetime64 )
943+ a1 .flags .writeable = False
944+ fam = FrozenAutoMap (a1 )
945+
946+ post = fam .get_any (
947+ np .array (["1854-05-02" , "2023-01-05" , "2020-01-05" ], np .datetime64 )
948+ )
949+ assert post == [1 , 0 ]
0 commit comments