Skip to content

CLN: remove check_series_type #32513

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

Merged
merged 2 commits into from
Mar 8, 2020
Merged

CLN: remove check_series_type #32513

merged 2 commits into from
Mar 8, 2020

Conversation

jbrockmendel
Copy link
Member

Trying to clean up assert_series_equal and avoid usage of _internal_get_values; I'm finding that these functions are weird, and in particular categorical dtype handling is opaque

@jreback jreback added Clean Testing pandas testing functions or related to the test suite labels Mar 8, 2020
@jreback jreback added this to the 1.1 milestone Mar 8, 2020
@jreback jreback merged commit 08c6597 into pandas-dev:master Mar 8, 2020
@jreback
Copy link
Contributor

jreback commented Mar 8, 2020

this is technically an api change, but not worth leaving it around, but can you add a note in the whatsnew

@jbrockmendel jbrockmendel deleted the tm2 branch March 8, 2020 16:23
@jorisvandenbossche
Copy link
Member

assert_series_equal is a public function, so we should not just remove keyword arguments, I think.

(this broke geopandas CI)

@jorisvandenbossche
Copy link
Member

And for subclasses, this keyword can actually be useful. What was the reason you wanted to remove it?

@jbrockmendel
Copy link
Member Author

What was the reason you wanted to remove it?

I'm trying to get rid of the _internal_get_values usages in assert_series_equal and finding the possible parameter combinations make that difficult. Since this one was unused internally, it seemed like a good candidate. If you want to re-introduce it, I have no objection.

@jorisvandenbossche
Copy link
Member

How is _internal_get_values and assert_series_equal related? That is only about checking the class type, but it's not related to the dtype?

@jbrockmendel
Copy link
Member Author

How is _internal_get_values and assert_series_equal related?

_internal_get_values is called a couple of times in assert_series_equal (more before this PR). Replacing the _internal_get_values usages with e.g. _values is the goal, but it turns out that breaks sometimes when we have Categorical _values. assert_series_equal has several parameters that change the behavior when we have categorical, and I was trying to narrow those down (see also #32527)

@jorisvandenbossche
Copy link
Member

Sorry, that still doesn't explain to me the relation to check_series_type, which basically only is this part of the diff:

-    if check_series_type:
-        # ToDo: There are some tests using rhs is sparse
-        # lhs is dense. Should use assert_class_equal in future
-        assert isinstance(left, type(right))
-        # assert_class_equal(left, right, obj=obj)
+    # TODO: There are some tests using rhs is sparse
+    # lhs is dense. Should use assert_class_equal in future
+    assert isinstance(left, type(right))
+    # assert_class_equal(left, right, obj=obj)

so how is that related to (or required by) the _internal_get_values changes?

@jbrockmendel
Copy link
Member Author

that still doesn't explain to me the relation to check_series_type

It isnt related, check_series_type was an innocent bystander that happens to be unused internally. Again, I have no objection if you want to restore it.

@jorisvandenbossche
Copy link
Member

Well, having that the title of the PR didn't give the impression of being an innocent bystander .. ;) (also your "I'm trying to get rid of the _internal_get_values usages in assert_series_equal and finding the possible parameter combinations make that difficult." seemed to indicate this was related, hence my confusion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants