-
Notifications
You must be signed in to change notification settings - Fork 652
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
Addition of isInstance
test of BackendSerial
#4773
base: develop
Are you sure you want to change the base?
Conversation
Addition of test for serial backend instance
Hello @talagayev! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2024-10-29 12:14:35 UTC |
pep fix
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4773 +/- ##
===========================================
- Coverage 93.66% 93.63% -0.03%
===========================================
Files 177 189 +12
Lines 21726 22792 +1066
Branches 3052 3052
===========================================
+ Hits 20349 21342 +993
- Misses 930 1003 +73
Partials 447 447 ☔ View full report in Codecov by Sentry. |
unsupported_backend=True | ||
) | ||
|
||
assert isinstance(serial_backend, backends.BackendSerial) |
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.
To me this test looks a bit self-referential. You are creating a backends.BackendSerial
and then just checking that said object is indeed backends.BackendSerial
. Could you please elaborate a bit more what is the intent here? I might be missing something...
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.
Yes the idea is the checking of this part of the code:
but I was not sure if the Issue idea was to test assert that backends.BackendSerial
runs as an input and assert the input, which is the current case or if the Idea is to test the backend
in FrameAnalysis(u.trajectory).run
So yes, looks confusing the pytest, since I am not sure which should be tested, that it works with backends.BackendSerial
or the isinstance(backend, BackendSerial)
If it is the latter, then I would modify the pytest
my bad for making it a little bit confusing 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.
Thank you for the clarification. To test the part of the code you linked, what I would do is to use pytest.raises
to make sure an exception is thrown when the backend is not serial.
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.
Ah I see, yes that makes sense, I will then adjust the PR accordingly :)
Fixes #4657
Changes made in this Pull Request:
test_instance_serial_backend
totest_base.py
to check that the function works and the instance is correctCurrently I just create a variable of
BackendSerial
forserial_backend
, which I use inFrameAnalysis(u.trajectory).run
to display that it runs with thebackend=serial_backend
and also then check the correct instance ofserial_backend
I wasn't sure here if I should check the instance of
backend
of therun()
inFrameAnalysis(u.trajectory).run(backend=serial_backend)
, since then I would need to modify the code to get the instance ofbackend
fromrun()
PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4773.org.readthedocs.build/en/4773/