@@ -156,16 +156,16 @@ def corner_to_cell_center_points(lat, lon):
156156@pytest .mark .parametrize (
157157 "array, x, expected_xi, expected_xsi" ,
158158 [
159- (np .array ([1 , 2 , 3 , 4 , 5 ]), 1.1 , 0 , 0.1 ),
159+ (np .array ([1 , 2 , 3 , 4 , 5 ]), ( 1.1 , 2.1 ), ( 0 , 1 ), ( 0.1 , 0.1 ) ),
160160 (np .array ([1 , 2 , 3 , 4 , 5 ]), 2.1 , 1 , 0.1 ),
161161 (np .array ([1 , 2 , 3 , 4 , 5 ]), 3.1 , 2 , 0.1 ),
162162 (np .array ([1 , 2 , 3 , 4 , 5 ]), 4.5 , 3 , 0.5 ),
163163 ],
164164)
165165def test_search_1d_array (array , x , expected_xi , expected_xsi ):
166166 xi , xsi = _search_1d_array (array , x )
167- assert xi == expected_xi
168- assert np .isclose (xsi , expected_xsi )
167+ np . testing . assert_array_equal ( xi , expected_xi )
168+ np .testing . assert_allclose (xsi , expected_xsi )
169169
170170
171171@pytest .mark .parametrize (
@@ -180,6 +180,18 @@ def test_search_1d_array_out_of_bounds(array, x, expected_xi):
180180 assert xi == expected_xi
181181
182182
183+ @pytest .mark .parametrize (
184+ "array, x, expected_xi" ,
185+ [
186+ (np .array ([1 , 2 , 3 , 4 , 5 ]), (- 0.1 , 2.5 ), (LEFT_OUT_OF_BOUNDS , 1 )),
187+ (np .array ([1 , 2 , 3 , 4 , 5 ]), (6.5 , 1 ), (RIGHT_OUT_OF_BOUNDS , 0 )),
188+ ],
189+ )
190+ def test_search_1d_array_some_out_of_bounds (array , x , expected_xi ):
191+ xi , _ = _search_1d_array (array , x )
192+ np .testing .assert_array_equal (xi , expected_xi )
193+
194+
183195@pytest .mark .parametrize (
184196 "ds, da_name, expected" ,
185197 [
0 commit comments