Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mwcraig
Copy link
Member

@mwcraig mwcraig commented May 6, 2025

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.

@mwcraig mwcraig requested a review from Copilot May 6, 2025 21:28
Copy link

@Copilot Copilot AI left a 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():
Copy link
Preview

Copilot AI May 6, 2025

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.

Suggested change
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):
Copy link
Preview

Copilot AI May 6, 2025

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.

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant