-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-4590 - Add type guards to async API methods #1820
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
Changes from all commits
d9ca03a
d265d98
efce7c3
438b9c9
4157417
fa48910
108ba8e
d5ae0d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,10 @@ def __init__( | |
) | ||
if not isinstance(name, str): | ||
raise TypeError("name must be an instance of str") | ||
from pymongo.synchronous.database import Database | ||
|
||
if not isinstance(database, Database): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm paranoid this might break apps that Mock pymongo classes but it should be fine. Anything that's mocking should inherit from our base classes anyway (instead of trying to ducktype). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, we'll have to watch out for bug reports with this. |
||
raise TypeError(f"Collection requires a Database but {type(database)} given") | ||
|
||
if not name or ".." in name: | ||
raise InvalidName("collection names cannot be empty") | ||
|
Uh oh!
There was an error while loading. Please reload this page.