Skip to content

Commit 88ce1f8

Browse files
committed
Only allow named extension array tests
1 parent 518b4f1 commit 88ce1f8

File tree

3 files changed

+401
-172
lines changed

3 files changed

+401
-172
lines changed

spatialpandas/tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pytest
2+
3+
4+
def pytest_collection_modifyitems(config, items):
5+
skip = pytest.mark.skip(reason='Not in "only_run_named_tests"')
6+
7+
for item in items:
8+
# If the class containing this test has the attribute "only_run_named_tests"
9+
# then tests with names not in that collection are skipped.
10+
include_list = getattr(item.cls, "only_run_named_tests", None)
11+
if include_list and item.originalname not in include_list:
12+
item.add_marker(skip)

spatialpandas/tests/test_fixedextensionarray.py

Lines changed: 194 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -143,113 +143,221 @@ def sort_by_key(request):
143143

144144
# Subclass BaseDtypeTests to run pandas-provided extension array test suite
145145
class TestGeometryConstructors(eb.BaseConstructorsTests):
146-
pass
146+
only_run_named_tests = set([
147+
"test_array_from_scalars",
148+
"test_construct_empty_dataframe",
149+
"test_dataframe_constructor_from_dict",
150+
"test_dataframe_from_series",
151+
"test_empty",
152+
"test_from_dtype",
153+
"test_from_sequence_from_cls",
154+
"test_pandas_array",
155+
"test_pandas_array_dtype",
156+
"test_series_constructor",
157+
"test_series_constructor_no_data_with_index",
158+
"test_series_constructor_scalar_na_with_index",
159+
"test_series_constructor_scalar_with_index",
160+
"test_series_given_mismatched_index_raises",
161+
])
147162

148163

149164
class TestGeometryDtype(eb.BaseDtypeTests):
150-
pass
165+
only_run_named_tests = set([
166+
"test_array_type",
167+
"test_check_dtype",
168+
"test_construct_from_string",
169+
"test_construct_from_string_another_type_raises",
170+
"test_construct_from_string_own_name",
171+
"test_construct_from_string_wrong_type_raises",
172+
"test_eq",
173+
"test_eq_with_numpy_object",
174+
"test_eq_with_self",
175+
"test_eq_with_str",
176+
"test_get_common_dtype",
177+
"test_hashable",
178+
"test_infer_dtype",
179+
"test_is_dtype_from_name",
180+
"test_is_dtype_from_self",
181+
"test_is_dtype_other_input",
182+
"test_is_dtype_unboxes_dtype",
183+
"test_is_not_object_type",
184+
"test_is_not_string_type",
185+
"test_kind",
186+
"test_name",
187+
"test_str",
188+
])
151189

152190

153191
class TestGeometryGetitem(eb.BaseGetitemTests):
154-
@pytest.mark.skip(reason="non-None fill value not supported")
155-
def test_take_non_na_fill_value(self):
156-
pass
157-
158-
@pytest.mark.skip(reason="non-None fill value not supported")
159-
def test_reindex_non_na_fill_value(self, data_missing):
160-
pass
161-
162-
@pytest.mark.skip("Cannot mask with a boolean indexer containing NA values")
163-
def test_getitem_boolean_na_treated_as_false(self, data):
164-
pass
165-
166-
@pytest.mark.skip("Passing an invalid index type is not supported")
167-
def test_getitem_invalid(self, data):
168-
pass
192+
only_run_named_tests = set([
193+
"test_ellipsis_index",
194+
"test_get",
195+
"test_getitem_boolean_array_mask",
196+
#"test_getitem_boolean_na_treated_as_false",
197+
"test_getitem_ellipsis_and_slice",
198+
"test_getitem_empty",
199+
"test_getitem_integer_array",
200+
"test_getitem_integer_with_missing_raises",
201+
#"test_getitem_invalid",
202+
"test_getitem_mask",
203+
"test_getitem_mask_raises",
204+
"test_getitem_scalar",
205+
"test_getitem_scalar_na",
206+
"test_getitem_series_integer_with_missing_raises",
207+
"test_getitem_slice",
208+
"test_iloc_frame",
209+
"test_iloc_frame_single_block",
210+
"test_iloc_series",
211+
"test_item",
212+
"test_loc_frame",
213+
"test_loc_iloc_frame_single_dtype",
214+
"test_loc_len1",
215+
"test_loc_series",
216+
"test_reindex",
217+
#"test_reindex_non_na_fill_value",
218+
"test_take",
219+
"test_take_empty",
220+
"test_take_negative",
221+
#"test_take_non_na_fill_value",
222+
"test_take_out_of_bounds_raises",
223+
"test_take_pandas_style_negative_raises",
224+
"test_take_sequence",
225+
"test_take_series",
226+
])
169227

170228

171229
class TestGeometryGroupby(eb.BaseGroupbyTests):
172-
@pytest.mark.skip(
173-
reason="The truth value of an array with more than one element is ambiguous."
174-
)
175-
def test_groupby_apply_identity(self):
176-
pass
230+
only_run_named_tests = set([
231+
"test_groupby_agg_extension",
232+
"test_groupby_apply_identity",
233+
"test_groupby_extension_agg",
234+
"test_groupby_extension_apply",
235+
"test_groupby_extension_no_sort",
236+
"test_groupby_extension_transform",
237+
"test_grouping_grouper",
238+
"test_in_numeric_groupby",
239+
])
177240

178241

179242
class TestGeometryInterface(eb.BaseInterfaceTests):
180-
# # NotImplementedError: 'GeometryList' does not support __setitem__
181-
@pytest.mark.skip(reason="__setitem__ not supported")
182-
def test_copy(self):
183-
pass
184-
185-
@pytest.mark.skip(reason="__setitem__ not supported")
186-
def test_view(self, data):
187-
pass
188-
189-
@pytest.mark.skip(reason="contains not supported")
190-
def test_contains(self):
191-
pass
243+
only_run_named_tests = set([
244+
"test_array_interface",
245+
"test_can_hold_na_valid",
246+
#"test_contains",
247+
#"test_copy",
248+
"test_is_extension_array_dtype",
249+
"test_isna_extension_array",
250+
"test_is_numeric_honored",
251+
"test_len",
252+
"test_memory_usage",
253+
"test_ndim",
254+
"test_no_values_attribute",
255+
"test_size",
256+
"test_tolist",
257+
#"test_view",
258+
])
192259

193260

194261
class TestGeometryMethods(eb.BaseMethodsTests):
195-
# # AttributeError: 'RaggedArray' object has no attribute 'value_counts'
196-
@pytest.mark.skip(reason="value_counts not supported")
197-
def test_value_counts(self):
198-
pass
199-
200-
# Ragged array elements don't support binary operators
201-
@pytest.mark.skip(reason="ragged does not support <= on elements")
202-
def test_combine_le(self):
203-
pass
204-
205-
@pytest.mark.skip(reason="ragged does not support + on elements")
206-
def test_combine_add(self):
207-
pass
208-
209-
@pytest.mark.skip(reason="combine_first not supported")
210-
def test_combine_first(self):
211-
pass
212-
213-
@pytest.mark.skip(reason="ragged does not support insert with an invalid scalar")
214-
def test_insert_invalid(self, data, invalid_scalar):
215-
pass
216-
217-
@pytest.mark.skip(
218-
reason="Searchsorted seems not implemented for custom extension arrays"
219-
)
220-
def test_searchsorted(self):
221-
pass
222-
223-
@pytest.mark.skip(
224-
reason="__setitem__ not supported"
225-
)
226-
def test_shift_0_periods(self, data):
227-
pass
228-
229-
@pytest.mark.skip(
230-
reason="value_counts not yet supported"
231-
)
232-
def test_value_counts_with_normalize(self, data):
233-
pass
234-
235-
@pytest.mark.skip(reason="ragged does not support where on elements")
236-
def test_where_series(self):
237-
pass
262+
only_run_named_tests = set([
263+
"test_apply_simple_series",
264+
"test_argmax_argmin_no_skipna_notimplemented",
265+
"test_argmin_argmax",
266+
"test_argmin_argmax_all_na",
267+
"test_argmin_argmax_empty_array",
268+
"test_argreduce_series",
269+
"test_argsort",
270+
"test_argsort_missing",
271+
"test_argsort_missing_array",
272+
#"test_combine_add",
273+
#"test_combine_first",
274+
#"test_combine_le",
275+
"test_container_shift",
276+
"test_count",
277+
"test_delete",
278+
"test_diff",
279+
"test_equals",
280+
"test_factorize",
281+
"test_factorize_empty",
282+
"test_factorize_equivalence",
283+
"test_fillna_copy_frame",
284+
"test_fillna_copy_series",
285+
"test_fillna_length_mismatch",
286+
"test_hash_pandas_object_works",
287+
"test_insert",
288+
#"test_insert_invalid",
289+
"test_insert_invalid_loc",
290+
"test_nargsort",
291+
"test_not_hashable",
292+
"test_repeat",
293+
"test_repeat_raises",
294+
#"test_searchsorted",
295+
"test_series_count",
296+
#"test_shift_0_periods",
297+
"test_shift_empty_array",
298+
"test_shift_fill_value",
299+
"test_shift_non_empty_array",
300+
"test_shift_zero_copies",
301+
"test_sort_values",
302+
"test_sort_values_frame",
303+
"test_sort_values_missing",
304+
"test_unique",
305+
#"test_value_counts",
306+
"test_value_counts_default_dropna",
307+
#"test_value_counts_with_normalize",
308+
#"test_where_series",
309+
])
238310

239311

240312
class TestGeometryPrinting(eb.BasePrintingTests):
241-
pass
313+
only_run_named_tests = set([
314+
"test_array_repr",
315+
"test_array_repr_unicode",
316+
"test_dataframe_repr",
317+
"test_dtype_name_in_info",
318+
"test_series_repr",
319+
])
242320

243321

244322
class TestGeometryMissing(eb.BaseMissingTests):
245-
pass
323+
only_run_named_tests = set([
324+
"test_dropna_array",
325+
"test_dropna_frame",
326+
"test_dropna_series",
327+
"test_fillna_fill_other",
328+
"test_fillna_frame",
329+
"test_fillna_limit_backfill",
330+
"test_fillna_limit_pad",
331+
"test_fillna_no_op_returns_copy",
332+
"test_fillna_scalar",
333+
"test_fillna_series",
334+
"test_fillna_series_method",
335+
"test_isna",
336+
"test_isna_returns_copy",
337+
"test_use_inf_as_na_no_effect",
338+
])
246339

247340

248341
class TestGeometryReshaping(eb.BaseReshapingTests):
249-
@pytest.mark.skip(reason="__setitem__ not supported")
250-
def test_ravel(self):
251-
pass
252-
253-
@pytest.mark.skip(reason="transpose with numpy array elements seems not supported")
254-
def test_transpose(self):
255-
pass
342+
only_run_named_tests = set([
343+
"test_align",
344+
"test_align_frame",
345+
"test_align_series_frame",
346+
"test_concat",
347+
"test_concat_all_na_block",
348+
"test_concat_columns",
349+
"test_concat_extension_arrays_copy_false",
350+
"test_concat_mixed_dtypes",
351+
"test_concat_with_reindex",
352+
"test_merge",
353+
"test_merge_on_extension_array",
354+
"test_merge_on_extension_array_duplicates",
355+
#"test_ravel",
356+
"test_set_frame_expand_extension_with_regular",
357+
"test_set_frame_expand_regular_with_extension",
358+
"test_set_frame_overwrite_object",
359+
"test_stack",
360+
#"test_transpose",
361+
"test_transpose_frame",
362+
"test_unstack",
363+
])

0 commit comments

Comments
 (0)