-
Couldn't load subscription status.
- Fork 71
Adds test to surface plotting for closed=True and "full torus" #510
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
base: master
Are you sure you want to change the base?
Conversation
…e previous plotting test, this test actually asserts that aspects of the plot has not changed (but tests may break if matplotlib updates).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #510 +/- ##
==========================================
+ Coverage 92.25% 92.34% +0.08%
==========================================
Files 82 82
Lines 16015 16019 +4
==========================================
+ Hits 14775 14792 +17
+ Misses 1240 1227 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Happy to approve this once you add a test of the logger warning, which is currently tanking the code coverage percentage here. Thanks! |
if the user tries to provide a non-3D axis to surface.plot() This uses unittest.mock to mock the Logger.warning() call, which is a testing methodology that isn't used elsewhere in simsopt.
I didn't do it since I wasn't sure how to check for warnings from logging.Logger. This way of testing is not used elsewhere in simsopt; we generally don't seem to have tests for warnings, just exceptions. Let me know if you think there is a better way to test for warning so that we do it right from the start. |
Is there a reason you can't use the default python warnings package instead of the logger warning? Warnings from this package can be easily tested. |
No reason except that that's seemingly not how warnings are done in the rest of SIMSOPT, except for a in a few files. |
| if c.__class__.__name__ == 'Poly3DCollection': | ||
| p = c | ||
| break | ||
| vec = p._vec # might be dangerous, not part of public matplotlib API |
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 probably avoid using non-public attributes
| def test_close_full_surface(self): | ||
| """ | ||
| Regression test for Surface.plot() with closed=True for a "full torus" surface. | ||
| Actually asserts that the plot has not changed by accessing `_vec` in |
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.
im having a hard time understanding what this test is covering?
|
@daringli can you take a look at this again? |
Surface.plot()Surface.plot()The test asserts that aspects of the plot has not changed. Downside: tests may break if matplotlib updates. Waiting for the CI to tell me if this is a serious problem or not. The old tests for the plots didn't actually assert anything so would not be able to catch regression problems that unless exceptions were raised.