Skip to content

Conversation

@mwcraig
Copy link
Member

@mwcraig mwcraig commented Jun 30, 2025

The bug was that the second time load_cagatalog is called without a style argument the style gets set to None instead of the default style.

The bug was that the second time loda_cagatalog is called without a style
argument the style gets set to None instead of the default style.
@mwcraig mwcraig requested a review from Copilot June 30, 2025 17:48
Copy link
Contributor

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 fixes a bug where calling load_catalog a second time without specifying a style would reset the catalog’s style to None, and adds a test to verify default style assignment.

  • Fix load_catalog to preserve an existing catalog style when no new style is provided
  • Add test_catalog_has_style_after_loading to ensure default styling is applied and persists
  • Minor formatting adjustment (blank line removal/addition)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/astro_image_display_api/image_viewer_logic.py Adjust load_catalog logic to reuse existing style if present
src/astro_image_display_api/api_test.py Add a new test (test_catalog_has_style_after_loading)
Comments suppressed due to low confidence (2)

src/astro_image_display_api/api_test.py:441

  • Add a test case where a custom style is provided on the first load_catalog call, then verify that a subsequent call without a style argument does not overwrite the custom style.
    def test_catalog_has_style_after_loading(self, catalog):

src/astro_image_display_api/image_viewer_logic.py:527

  • [nitpick] Align the comment indentation exactly with the surrounding code block to match project style (4 spaces under the if), improving readability.
                # No style has been set, so use the default style

@mwcraig mwcraig merged commit 3ec9078 into astropy:main Jun 30, 2025
7 checks passed
@mwcraig mwcraig deleted the fix-viewer-logic-bug branch June 30, 2025 18:40
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