Skip to content

PYTHON-5387 Better test assertions for membership #2348

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 6 commits into from
May 23, 2025

Conversation

sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick commented May 21, 2025

Another PR for PYTHON-5262, this one is for in:
self.assertTrue(... in ...) -> self.assertIn(..., ...)
self.assertTrue(... not in ...) -> self.assertNotIn(..., ...)
self.assertFalse(... in ...) -> self.assertNotIn(..., ...)

@sleepyStick sleepyStick marked this pull request as ready for review May 22, 2025 17:10
@@ -933,16 +933,19 @@ async def test_clone(self):
# Shallow copies can so can mutate
cursor2 = copy.copy(cursor)
cursor2._projection["cursor2"] = False
self.assertTrue(cursor._projection and "cursor2" in cursor._projection)
self.assertIsNotNone(cursor._projection)
Copy link
Contributor Author

@sleepyStick sleepyStick May 22, 2025

Choose a reason for hiding this comment

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

in the spirit of better test assertions, I broke it up into two assertions..(and assumed the first cursor._projection was to check that it is not None) if that's an incorrect assumption, or we prefer the original way, I'm happy to change these back to the original (or something else)

@sleepyStick sleepyStick changed the title PYTHON-5262 Better test assertions for in PYTHON-5287 Better test assertions for in May 22, 2025
@sleepyStick sleepyStick changed the title PYTHON-5287 Better test assertions for in PYTHON-5387 Better test assertions for in May 22, 2025
NoahStapp
NoahStapp previously approved these changes May 22, 2025
@blink1073 blink1073 changed the title PYTHON-5387 Better test assertions for in PYTHON-5387 Better test assertions for membership May 23, 2025
@sleepyStick sleepyStick merged commit b8460b6 into mongodb:master May 23, 2025
77 of 79 checks passed
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 this pull request may close these issues.

3 participants