-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add a dummy vieweras 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
base: main
Are you sure you want to change the base?
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.
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.