Skip to content

Added tests for 100% coverage#416

Merged
psomhorst merged 2 commits intodevelopfrom
412_expand_testing_PixelMaskCollection
Aug 13, 2025
Merged

Added tests for 100% coverage#416
psomhorst merged 2 commits intodevelopfrom
412_expand_testing_PixelMaskCollection

Conversation

@JulietteFrancovich
Copy link
Copy Markdown
Contributor

No description provided.

@JulietteFrancovich JulietteFrancovich linked an issue Aug 13, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@psomhorst psomhorst left a comment

Choose a reason for hiding this comment

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

@JulietteFrancovich Sorry, I was confused about who wrote these tests, and should have assigned the issue this to myself. Thanks for the prompt response, though.

I don't see how mocking adds anything to already existing tests with real data. Let's make sure you get that data ASAP?

If you prefer, I can finish this PR.

Comment on lines +549 to +551
with pytest.raises(ValueError) as excinfo:
collection.combine(method="invalid")
assert "Unsupported method" in str(excinfo.value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
with pytest.raises(ValueError) as excinfo:
collection.combine(method="invalid")
assert "Unsupported method" in str(excinfo.value)
with pytest.raises(ValueError, match="Unsupported method):
collection.combine(method="invalid")

Comment on lines +540 to +546
# Test sum method
summed = collection.combine(method="sum")
assert isinstance(summed, PixelMask)

# Test product method
product = collection.combine(method="product")
assert isinstance(product, PixelMask)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't these be done in another combine test? This function now tests three things that are not really related, while other tests already test the functioning of combine.

assert "Unsupported data type" in str(excinfo.value)


def test_apply_to_eitdata_branch():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does this test add over test_apply_to_eitdata_labelled?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For some reason test_apply_to_eitdata_labelled does not cover lines 308 and 309 in PixelMaskCollection.py:
308 case EITData(): 308 ↛ 309
309 return self._apply_mask_data(data, label_format,

This new test does but perhaps a better solution would be to understand why test_apply_to_eitdata_labelled doesn't....

Copy link
Copy Markdown
Contributor

@psomhorst psomhorst Aug 13, 2025

Choose a reason for hiding this comment

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

It does for me... Doesn't it skip/fail some tests because of missing data on your side?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh check, it does. That explains (blonde moment)...

Comment on lines +329 to +331
with pytest.raises(TypeError) as excinfo:
collection.apply("not a valid type")
assert "Unsupported data type" in str(excinfo.value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
with pytest.raises(TypeError) as excinfo:
collection.apply("not a valid type")
assert "Unsupported data type" in str(excinfo.value)
with pytest.raises(TypeError, match="Unsupported data type"):
collection.apply("not a valid type")

@JulietteFrancovich
Copy link
Copy Markdown
Contributor Author

@JulietteFrancovich Sorry, I was confused about who wrote these tests, and should have assigned the issue this to myself. Thanks for the prompt response, though.

I don't see how mocking adds anything to already existing tests with real data. Let's make sure you get that data ASAP?

If you prefer, I can finish this PR.

I was confused too ;) but made a start. I think probably best if you finish the PR with tests with the real data (as the mocking was indeed a (sloppy) workaround).

@psomhorst
Copy link
Copy Markdown
Contributor

I was confused too ;)

You can just unassigned yourself and assign it to me instead ;)

@psomhorst psomhorst merged commit dfd1683 into develop Aug 13, 2025
3 checks passed
@psomhorst psomhorst deleted the 412_expand_testing_PixelMaskCollection branch August 13, 2025 14:42
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.

Add check for PixelMaskCollection.combine() method argument

2 participants