-
Notifications
You must be signed in to change notification settings - Fork 4
Add aliases to resolve discrepancy in naming #36
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should tests that:
- Both ExplainCollection and ExplainableCollection can be imported directly from
pymongoexplain
. - ExplainCollection and ExplainableCollection are the same.
# Alias | ||
ExplainCollection = ExplainableCollection | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are some extra newlines here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/test_collection.py
Outdated
except: | ||
print("Could not import!") | ||
assert False | ||
assert ExplainableCollection == ExplainCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the try/excepts and use self.assertEqual
instead of bare assert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/test_collection.py
Outdated
try: | ||
from pymongoexplain import ExplainCollection | ||
except: | ||
print("Could not import!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace these two lines with:
self.fail("Failed to import ExplainCollection from pymongoexplain")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/test_collection.py
Outdated
from pymongoexplain import ExplainableCollection | ||
except: | ||
print("Could not import!") | ||
assert False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test/test_collection.py
Outdated
except: | ||
print("Could not import!") | ||
assert False | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest leaving a newline between the two sub-tests to make this more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -213,5 +213,11 @@ def test_cli_tool(self): | |||
self.assertNotEqual(res.stdout, "") | |||
self.assertTrue(res.returncode == 0) | |||
|
|||
def test_imports(self): | |||
from pymongoexplain import ExplainCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, simple solution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think after #33 is merged, you need to rebase this on top of master and add a changelog entry for the addition of the alias.
Done. |
No description provided.