@@ -17,39 +17,38 @@ def test_filter_by_id_kwarg(fancy_test_array: FancyTestArray):
1717 array = fancy_test_array .filter (id = 1 )
1818 assert isinstance (array , FancyTestArray )
1919 assert array .size == 1
20- assert array . id == 1
20+ assert array [ "id" ] == 1
2121
2222
2323def test_filter_by_id_arg (fancy_test_array : FancyTestArray ):
2424 array = fancy_test_array .filter (1 )
2525 assert array .size == 1
26- assert array . id == 1
26+ assert array [ "id" ] == 1
2727
2828
2929def test_filter_keeps_original_order ():
3030 original_array = FancyTestArray .zeros (9 )
31- original_array . id = [1 , 3 , 2 , 4 , 5 , 6 , 7 , 8 , 16 ]
31+ original_array [ "id" ] = [1 , 3 , 2 , 4 , 5 , 6 , 7 , 8 , 16 ]
3232 array = original_array .filter (id = [2 , 4 , 5 , 16 , 3 ])
33- np .testing .assert_array_equal ([3 , 2 , 4 , 5 , 16 ], array . id )
33+ np .testing .assert_array_equal ([3 , 2 , 4 , 5 , 16 ], array [ "id" ] )
3434
3535
3636def test_filter_by_int (fancy_test_array : FancyTestArray ):
3737 array = fancy_test_array .filter (test_int = 4 )
3838 assert array .size == 1
39- assert array . test_int == 4
39+ assert array [ " test_int" ] == 4
4040
4141
4242def test_filter_by_float (fancy_test_array : FancyTestArray ):
4343 array = fancy_test_array .filter (test_float = 1.0 )
4444 assert array .size == 1
45- record = array .record
46- assert math .isclose (record .test_float , 1.0 )
45+ assert math .isclose (array ["test_float" ].item (), 1.0 )
4746
4847
4948def test_filter_by_str (fancy_test_array : FancyTestArray ):
5049 array = fancy_test_array .filter (test_str = "c" )
5150 assert array .size == 1
52- assert array . test_str == "c"
51+ assert array [ " test_str" ] == "c"
5352
5453
5554def test_filter_no_match (fancy_test_array : FancyTestArray ):
@@ -60,7 +59,7 @@ def test_filter_no_match(fancy_test_array: FancyTestArray):
6059def test_filter_multiple_matches (fancy_test_array : FancyTestArray ):
6160 array = fancy_test_array .filter (test_float = 4.0 )
6261 assert array .size == 2
63- assert_array_equal (array . test_float , [4.0 , 4.0 ])
62+ assert_array_equal (array [ " test_float" ] , [4.0 , 4.0 ])
6463
6564
6665def test_filter_no_input (fancy_test_array : FancyTestArray ):
@@ -76,7 +75,7 @@ def test_filter_empty_list_input(fancy_test_array: FancyTestArray):
7675def test_filter_mode_or (fancy_test_array : FancyTestArray ):
7776 array = fancy_test_array .filter (test_float = 1.0 , test_str = "a" , mode_ = "OR" )
7877 assert 2 == array .size
79- assert_array_equal (array . id , [1 , 3 ])
78+ assert_array_equal (array [ "id" ] , [1 , 3 ])
8079
8180
8281def test_filter_mask_by_id_kwarg (fancy_test_array : FancyTestArray ):
@@ -134,11 +133,11 @@ def test_filter_kwarg_by_set_input(fancy_test_array: FancyTestArray):
134133 array = fancy_test_array .filter (id = {1 })
135134 assert isinstance (array , FancyTestArray )
136135 assert array .size == 1
137- assert array . id == 1
136+ assert array [ "id" ] == 1
138137
139138
140139def test_filter_arg_by_set_input (fancy_test_array : FancyTestArray ):
141140 array = fancy_test_array .filter ({1 , 2 })
142141 assert isinstance (array , FancyTestArray )
143142 assert array .size == 2
144- assert_array_equal (array . id , [1 , 2 ])
143+ assert_array_equal (array [ "id" ] , [1 , 2 ])
0 commit comments