-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add a dummy viewer as a minimal implementation example #16
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.
Pull Request Overview
This PR introduces a dummy viewer implementation to serve as an example and exercise the API assumptions detailed in issue #12. Key changes include:
- Importing and using the dummy viewer in tests
- Adding a new test function to verify the dummy viewer instance
- Creating a test case class that inherits from the widget API test suite
@@ -27,3 +28,12 @@ def test_api_test_class_completeness(): | |||
"ImageWidgetAPITest does not access these attributes/methods:\n " | |||
f"{"\n".join(attr for attr, present in zip(required_attributes, attr_present) if not present)}. " | |||
) | |||
|
|||
|
|||
def test_instance(): |
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.
[nitpick] Consider adding a docstring to the test_instance function to clarify its purpose for future maintainers.
def test_instance(): | |
def test_instance(): | |
""" | |
Test that an instance of ImageViewer conforms to the ImageViewerInterface. | |
""" |
Copilot uses AI. Check for mistakes.
assert isinstance(image, ImageViewerInterface) | ||
|
||
|
||
class TestDummyViewer(ImageWidgetAPITest): |
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.
[nitpick] Adding a brief docstring for TestDummyViewer could help clarify its role and intended usage, improving future maintainability.
class TestDummyViewer(ImageWidgetAPITest): | |
class TestDummyViewer(ImageWidgetAPITest): | |
""" | |
A test implementation of ImageWidgetAPITest that uses the ImageViewer | |
class as the widget under test. | |
""" |
Copilot uses AI. Check for mistakes.
cb491d5
to
1d80d7e
Compare
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.
Pull Request Overview
This PR adds a dummy viewer as a minimal implementation example to expose unstated API assumptions and provide downstream API compatibility tests.
- Adds a new test file (test_dummy_viewer.py) that verifies ImageViewer implements ImageViewerInterface and conforms to the widget API.
- Updates tests/test_astro_image_display_api.py by removing an extraneous line to clean up the file.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/test_dummy_viewer.py | Adds tests to verify implementation and API usage |
tests/test_astro_image_display_api.py | Removes a stray line to tidy up the test file |
The main reason for adding this -- and I don't really care if it stays in this package long-term -- is that it helps expose some of the unstated assumptions in the API (like interactions between the states of different settings, see #12) and provides, in the test file, an example of how downstream classes would demonstrate API compatibility.