Skip to content
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

Bugfix for implementation and test for invalid file type input in make_cube() #129

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

snbianco
Copy link
Collaborator

The test environment using dev dependencies has been failing due to a recent change in Astroquery. Because Astroquery no longer allows users to get products for TESS/TICA FFIs, test_make_cube.py::test_invalid_inputs was no longer passing. I modified the test to use the create_test_ffis function rather than Astroquery.

While doing this, I also discovered a small bug in the CubeFactory implementation when TICA files are passed in. I moved the try-catch block in CubeFactory._configure_cube to catch and output the error the first time that access to ffi_data[1] is attempted.

@snbianco snbianco marked this pull request as ready for review September 24, 2024 03:02
havok2063
havok2063 previously approved these changes Sep 24, 2024
Copy link
Contributor

@havok2063 havok2063 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a small optional comment, but otherwise looks good to me.

Comment on lines 191 to 194
# Should raise a Value Error due to incorrect file type
with pytest.raises(ValueError) as error_msg:
cube_maker.make_cube(manifest["Local Path"])
cube_maker.make_cube(ffi_files)
assert value_error in str(error_msg.value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest.raises has a match keyword that takes a string, or regex pattern to match against the raised error message, simplifying this usage slightly. For example:

with pytest.raises(ValueError, match=value_error):
    cube_maker.make_cube(ffi_files)

Sometimes it's finicky about exact strings versus a "regex" string. In those cases I usually give it a sub-string of the full error message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thank you! Just made that change.

@snbianco snbianco merged commit 890ee87 into main Sep 24, 2024
8 checks passed
@snbianco snbianco deleted the ASB-28917-test-fix branch September 24, 2024 14:13
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.

2 participants