Skip to content

gh-106135: Improve test_patma with more cases #106271

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
Jun 30, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 30, 2023

I've covered all bullet list items for my original issue.
Do you have some extra test ideas? :)

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

You gave me an idea for another test, but no pressure to add it. I'll give you some time just in case you want to, and merge in a day or two regardless:

self.assertIs(f(1, X(-1)), None)

def test_patma_252(self):
# Side effects must be possible in guards:
Copy link
Member

Choose a reason for hiding this comment

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

If you want to be really crazy, you could add another test with something like this:

x = []
match x:
    case [] as z if z.append(None):
        y = 0
    case [None]:
        y = 1
self.assertEqual(x, [None])
self.assertEqual(y, 1)
self.assertIs(z, x)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! 👍

@brandtbucher brandtbucher enabled auto-merge (squash) June 30, 2023 19:29
@brandtbucher brandtbucher merged commit 904aef9 into python:main Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants