Skip to content
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

mypy typing issues for decimal pandas/tests/extension/decimal/test_decimal.py #28988

Closed

Conversation

yogendrasoni
Copy link
Contributor

@yogendrasoni yogendrasoni commented Oct 15, 2019

@yogendrasoni yogendrasoni changed the title Test decimal typefix fix #28926 Test decimal pandas/tests/extension/decimal/test_decimal.py Oct 15, 2019
@yogendrasoni yogendrasoni changed the title fix #28926 Test decimal pandas/tests/extension/decimal/test_decimal.py fix #28926 mypy typing issues for decimal pandas/tests/extension/decimal/test_decimal.py Oct 15, 2019
@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Oct 15, 2019
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yogendrasoni Thanks for the PR. A couple of suggestions.

Comment on lines 157 to 159
[mypy-pandas.tests.extension.decimal.test_decimal]
ignore_errors=True
ignore_errors=False

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this entire section from setup.cfg

@@ -110,35 +110,35 @@ def assert_frame_equal(self, left, right, *args, **kwargs):
tm.assert_frame_equal(left, right, *args, **kwargs)


class TestDtype(BaseDecimal, base.BaseDtypeTests):
class TestDtype(BaseDecimal, base.BaseDtypeTests): # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of silencing the mypy errors can you make the signatures of assert_series_equal and assert_frame_equal compatible between BaseDecimal and BaseExtensionTests.

make the methods in BaseDecimal staticmethods and define the methods in BaseExtensionTests to be compatibile using *args and **kwargs, i.e.

    @staticmethod
    def assert_series_equal(left, right, *args, **kwargs):
        tm.assert_series_equal(left, right, *args, **kwargs)

    @staticmethod
    def assert_frame_equal(left, right, *args, **kwargs):
        tm.assert_frame_equal(left, right, *args, **kwargs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried putting staticmethod, BaseExtensionTests methods takes (left,right, some arguments) but BaseDecimal takes (left,right,*args,**kwargs) it is still showing incompatible by mypy, didn't find anything to solve this. I need to study more to solve this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think #28994 has the same issue. What error are you getting after trying what @simonjayhawkins suggested?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we have two modules that are reporting mypy errors due to the same root issue.

@simonjayhawkins simonjayhawkins changed the title fix #28926 mypy typing issues for decimal pandas/tests/extension/decimal/test_decimal.py mypy typing issues for decimal pandas/tests/extension/decimal/test_decimal.py Oct 21, 2019
@jbrockmendel
Copy link
Member

@simonjayhawkins am i right in thinking that the # type: ignore this uses is something were trying pretty hard to avoid?

@simonjayhawkins
Copy link
Member

@simonjayhawkins am i right in thinking that the # type: ignore this uses is something were trying pretty hard to avoid?

correct.

@WillAyd
Copy link
Member

WillAyd commented Dec 17, 2019

@yogendrasoni is this still active?

@jreback
Copy link
Contributor

jreback commented Dec 27, 2019

closing as stale, if you'ld like to continue, pls ping.

@jreback jreback closed this Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants