-
-
Notifications
You must be signed in to change notification settings - Fork 4
Remove image_height and image_width attributes; test that every method/attribute has docs
#77
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 removes the now-unnecessary image_width and image_height attributes from the interface and implementation, and adds enforcement that every method/property has a docstring via a new decorator and tests.
- Deleted
image_width/image_heightfrom the protocol and logic classes. - Introduced
docs_from_interfacedecorator to copy docstrings from the interface. - Added tests ensuring all interface methods/attributes have docs.
- Replaced hard-coded image dimensions in tests with
DEFAULT_IMAGE_SHAPE.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_astro_image_display_api.py | Added test_every_method_attribute_has_docstring. |
| src/astro_image_display_api/interface_definition.py | Removed image_width and image_height attributes from protocol. |
| src/astro_image_display_api/image_viewer_logic.py | Added docs_from_interface decorator; removed manual __doc__ assignments. |
| src/astro_image_display_api/api_test.py | Introduced DEFAULT_IMAGE_SHAPE; updated fixtures and tests; removed width/height tests. |
Comments suppressed due to low confidence (2)
src/astro_image_display_api/api_test.py:21
- [nitpick] The tuple
DEFAULT_IMAGE_SHAPEis ambiguous (height vs width); consider using separate constants or renaming (e.g.DEFAULT_IMAGE_HEIGHTandDEFAULT_IMAGE_WIDTH) for clarity.
DEFAULT_IMAGE_SHAPE = (100, 150)
src/astro_image_display_api/image_viewer_logic.py:56
- The decorator references
ImageViewerInterfacebut there’s no import in this file; please addfrom astro_image_display_api.interface_definition import ImageViewerInterfaceat the top.
def docs_from_interface(cls):
| ) | ||
|
|
||
|
|
||
| def test_every_method_attribute_has_docstring(): |
Copilot
AI
Jul 8, 2025
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] This test is duplicated in api_test.py; consider extracting a shared helper or fixture to avoid copy–paste.
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.
That is deliberate. One is used internally, one is meant to be used externally.
This removes the
image_heightandimage_widthproperties. These things are determined by the image that is loaded.This also checks that every method/property in the interface and the sample implementation has a docstring.