Skip to content

Only allow named extension array tests #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spatialpandas/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest


def pytest_collection_modifyitems(config, items):
skip = pytest.mark.skip(reason='Not in "only_run_named_tests"')

for item in items:
# If the class containing this test has the attribute "only_run_named_tests"
# then tests with names not in that collection are skipped.
include_list = getattr(item.cls, "only_run_named_tests", None)
if include_list and item.originalname not in include_list:
item.add_marker(skip)
280 changes: 194 additions & 86 deletions spatialpandas/tests/test_fixedextensionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,113 +143,221 @@ def sort_by_key(request):

# Subclass BaseDtypeTests to run pandas-provided extension array test suite
class TestGeometryConstructors(eb.BaseConstructorsTests):
pass
only_run_named_tests = set([
"test_array_from_scalars",
"test_construct_empty_dataframe",
"test_dataframe_constructor_from_dict",
"test_dataframe_from_series",
"test_empty",
"test_from_dtype",
"test_from_sequence_from_cls",
"test_pandas_array",
"test_pandas_array_dtype",
"test_series_constructor",
"test_series_constructor_no_data_with_index",
"test_series_constructor_scalar_na_with_index",
"test_series_constructor_scalar_with_index",
"test_series_given_mismatched_index_raises",
])


class TestGeometryDtype(eb.BaseDtypeTests):
pass
only_run_named_tests = set([
"test_array_type",
"test_check_dtype",
"test_construct_from_string",
"test_construct_from_string_another_type_raises",
"test_construct_from_string_own_name",
"test_construct_from_string_wrong_type_raises",
"test_eq",
"test_eq_with_numpy_object",
"test_eq_with_self",
"test_eq_with_str",
"test_get_common_dtype",
"test_hashable",
"test_infer_dtype",
"test_is_dtype_from_name",
"test_is_dtype_from_self",
"test_is_dtype_other_input",
"test_is_dtype_unboxes_dtype",
"test_is_not_object_type",
"test_is_not_string_type",
"test_kind",
"test_name",
"test_str",
])


class TestGeometryGetitem(eb.BaseGetitemTests):
@pytest.mark.skip(reason="non-None fill value not supported")
def test_take_non_na_fill_value(self):
pass

@pytest.mark.skip(reason="non-None fill value not supported")
def test_reindex_non_na_fill_value(self, data_missing):
pass

@pytest.mark.skip("Cannot mask with a boolean indexer containing NA values")
def test_getitem_boolean_na_treated_as_false(self, data):
pass

@pytest.mark.skip("Passing an invalid index type is not supported")
def test_getitem_invalid(self, data):
pass
only_run_named_tests = set([
"test_ellipsis_index",
"test_get",
"test_getitem_boolean_array_mask",
#"test_getitem_boolean_na_treated_as_false",
"test_getitem_ellipsis_and_slice",
"test_getitem_empty",
"test_getitem_integer_array",
"test_getitem_integer_with_missing_raises",
#"test_getitem_invalid",
"test_getitem_mask",
"test_getitem_mask_raises",
"test_getitem_scalar",
"test_getitem_scalar_na",
"test_getitem_series_integer_with_missing_raises",
"test_getitem_slice",
"test_iloc_frame",
"test_iloc_frame_single_block",
"test_iloc_series",
"test_item",
"test_loc_frame",
"test_loc_iloc_frame_single_dtype",
"test_loc_len1",
"test_loc_series",
"test_reindex",
#"test_reindex_non_na_fill_value",
"test_take",
"test_take_empty",
"test_take_negative",
#"test_take_non_na_fill_value",
"test_take_out_of_bounds_raises",
"test_take_pandas_style_negative_raises",
"test_take_sequence",
"test_take_series",
])


class TestGeometryGroupby(eb.BaseGroupbyTests):
@pytest.mark.skip(
reason="The truth value of an array with more than one element is ambiguous."
)
def test_groupby_apply_identity(self):
pass
only_run_named_tests = set([
"test_groupby_agg_extension",
"test_groupby_apply_identity",
"test_groupby_extension_agg",
"test_groupby_extension_apply",
"test_groupby_extension_no_sort",
"test_groupby_extension_transform",
"test_grouping_grouper",
"test_in_numeric_groupby",
])


class TestGeometryInterface(eb.BaseInterfaceTests):
# # NotImplementedError: 'GeometryList' does not support __setitem__
@pytest.mark.skip(reason="__setitem__ not supported")
def test_copy(self):
pass

@pytest.mark.skip(reason="__setitem__ not supported")
def test_view(self, data):
pass

@pytest.mark.skip(reason="contains not supported")
def test_contains(self):
pass
only_run_named_tests = set([
"test_array_interface",
"test_can_hold_na_valid",
#"test_contains",
#"test_copy",
"test_is_extension_array_dtype",
"test_isna_extension_array",
"test_is_numeric_honored",
"test_len",
"test_memory_usage",
"test_ndim",
"test_no_values_attribute",
"test_size",
"test_tolist",
#"test_view",
])


class TestGeometryMethods(eb.BaseMethodsTests):
# # AttributeError: 'RaggedArray' object has no attribute 'value_counts'
@pytest.mark.skip(reason="value_counts not supported")
def test_value_counts(self):
pass

# Ragged array elements don't support binary operators
@pytest.mark.skip(reason="ragged does not support <= on elements")
def test_combine_le(self):
pass

@pytest.mark.skip(reason="ragged does not support + on elements")
def test_combine_add(self):
pass

@pytest.mark.skip(reason="combine_first not supported")
def test_combine_first(self):
pass

@pytest.mark.skip(reason="ragged does not support insert with an invalid scalar")
def test_insert_invalid(self, data, invalid_scalar):
pass

@pytest.mark.skip(
reason="Searchsorted seems not implemented for custom extension arrays"
)
def test_searchsorted(self):
pass

@pytest.mark.skip(
reason="__setitem__ not supported"
)
def test_shift_0_periods(self, data):
pass

@pytest.mark.skip(
reason="value_counts not yet supported"
)
def test_value_counts_with_normalize(self, data):
pass

@pytest.mark.skip(reason="ragged does not support where on elements")
def test_where_series(self):
pass
only_run_named_tests = set([
"test_apply_simple_series",
"test_argmax_argmin_no_skipna_notimplemented",
"test_argmin_argmax",
"test_argmin_argmax_all_na",
"test_argmin_argmax_empty_array",
"test_argreduce_series",
"test_argsort",
"test_argsort_missing",
"test_argsort_missing_array",
#"test_combine_add",
#"test_combine_first",
#"test_combine_le",
"test_container_shift",
"test_count",
"test_delete",
"test_diff",
"test_equals",
"test_factorize",
"test_factorize_empty",
"test_factorize_equivalence",
"test_fillna_copy_frame",
"test_fillna_copy_series",
"test_fillna_length_mismatch",
"test_hash_pandas_object_works",
"test_insert",
#"test_insert_invalid",
"test_insert_invalid_loc",
"test_nargsort",
"test_not_hashable",
"test_repeat",
"test_repeat_raises",
#"test_searchsorted",
"test_series_count",
#"test_shift_0_periods",
"test_shift_empty_array",
"test_shift_fill_value",
"test_shift_non_empty_array",
"test_shift_zero_copies",
"test_sort_values",
"test_sort_values_frame",
"test_sort_values_missing",
"test_unique",
#"test_value_counts",
"test_value_counts_default_dropna",
#"test_value_counts_with_normalize",
#"test_where_series",
])


class TestGeometryPrinting(eb.BasePrintingTests):
pass
only_run_named_tests = set([
"test_array_repr",
"test_array_repr_unicode",
"test_dataframe_repr",
"test_dtype_name_in_info",
"test_series_repr",
])


class TestGeometryMissing(eb.BaseMissingTests):
pass
only_run_named_tests = set([
"test_dropna_array",
"test_dropna_frame",
"test_dropna_series",
"test_fillna_fill_other",
"test_fillna_frame",
"test_fillna_limit_backfill",
"test_fillna_limit_pad",
"test_fillna_no_op_returns_copy",
"test_fillna_scalar",
"test_fillna_series",
"test_fillna_series_method",
"test_isna",
"test_isna_returns_copy",
"test_use_inf_as_na_no_effect",
])


class TestGeometryReshaping(eb.BaseReshapingTests):
@pytest.mark.skip(reason="__setitem__ not supported")
def test_ravel(self):
pass

@pytest.mark.skip(reason="transpose with numpy array elements seems not supported")
def test_transpose(self):
pass
only_run_named_tests = set([
"test_align",
"test_align_frame",
"test_align_series_frame",
"test_concat",
"test_concat_all_na_block",
"test_concat_columns",
"test_concat_extension_arrays_copy_false",
"test_concat_mixed_dtypes",
"test_concat_with_reindex",
"test_merge",
"test_merge_on_extension_array",
"test_merge_on_extension_array_duplicates",
#"test_ravel",
"test_set_frame_expand_extension_with_regular",
"test_set_frame_expand_regular_with_extension",
"test_set_frame_overwrite_object",
"test_stack",
#"test_transpose",
"test_transpose_frame",
"test_unstack",
])
Loading