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

isinstance sometimes puts closing paren in wrong place #35

Closed
bmerry opened this issue May 16, 2022 · 2 comments · Fixed by #36
Closed

isinstance sometimes puts closing paren in wrong place #35

bmerry opened this issue May 16, 2022 · 2 comments · Fixed by #36

Comments

@bmerry
Copy link

bmerry commented May 16, 2022

class TestFoo(unittest.TestCase):
    def test_foo(self):
        self.assertIsInstance(x, y)
        self.assertIsInstance(x, y)

gets rewritten to

class TestFoo:
    def test_foo(self):
        assert isinstance(x), y
        assert isinstance(x, y)

I did a bit of debugging, and I think the issue is that the search for a second comma (indicating a failure message) is too aggressive and continues past the end of the call and onto the next line. It needs to be constrained to not search past the close paren.

@dannysepler
Copy link
Owner

great catch. appreciate you tracking down the reason

@dannysepler
Copy link
Owner

fixed in v1.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants