Skip to content

Commit

Permalink
Ignore init setup etc from codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Mar 5, 2024
1 parent ebbf1ac commit 6e866c4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
5 changes: 2 additions & 3 deletions drizzle/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class initializer can allocate these arrays based on other input

def __init__(self, kernel="square", fillval=None, out_shape=None,
out_img=None, out_wht=None, out_ctx=None, exptime=0.0,
begin_ctx_id=0, max_ctx_id=None):
begin_ctx_id=None, max_ctx_id=None):
"""
kernel: str, optional
The name of the kernel used to combine the input. The choice of
Expand Down Expand Up @@ -234,8 +234,7 @@ def __init__(self, kernel="square", fillval=None, out_shape=None,
"""
if begin_ctx_id < 0:
ValueError("Invalid context image ID")

raise ValueError("Invalid context image ID")
self._ctx_id = begin_ctx_id # the ID of the *last* image to be resampled
if max_ctx_id is None:
max_ctx_id = begin_ctx_id

Check warning on line 240 in drizzle/resample.py

View check run for this annotation

Codecov / codecov/patch

drizzle/resample.py#L240

Added line #L240 was not covered by tests
Expand Down
36 changes: 18 additions & 18 deletions drizzle/tests/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,13 +898,29 @@ def test_context_planes():
"'out_ctx' must be either a 2D or 3D array."
)

driz = resample.Drizzle(
kernel='square',
out_shape=output_wcs.array_shape,
fillval=0.0,
)

for i in range(32):
assert driz.ctx_id == i
driz.add_image(image, exptime=1.0, pixmap=pixmap)
assert driz.out_ctx.shape == (1, 10, 10)

driz.add_image(image, exptime=1.0, pixmap=pixmap)
assert driz.out_ctx.shape == (2, 10, 10)


def test_init_ctx_id():
# starting context ID must be positive
with pytest.raises(ValueError) as err_info:
resample.Drizzle(
kernel='square',
exptime=0.0,
out_shape=shape,
begin_ctx_id=-1,
out_shape=(10, 10),
)
assert str(err_info.value).startswith(
"Invalid context image ID"
Expand All @@ -914,30 +930,14 @@ def test_context_planes():
resample.Drizzle(
kernel='square',
exptime=0.0,
out_shape=shape,
out_shape=(10, 10),
begin_ctx_id=1,
max_ctx_id=0,
)
assert str(err_info.value).startswith(
"'max_ctx_id' cannot be smaller than 'begin_ctx_id'."
)

driz = resample.Drizzle(
kernel='square',
out_shape=output_wcs.array_shape,
fillval=0.0,
)

for i in range(32):
assert driz.ctx_id == i
driz.add_image(image, exptime=1.0, pixmap=pixmap)
assert driz.out_ctx.shape == (1, 10, 10)

driz.add_image(image, exptime=1.0, pixmap=pixmap)
assert driz.out_ctx.shape == (2, 10, 10)




@pytest.mark.parametrize(
'kernel,fc',
Expand Down

0 comments on commit 6e866c4

Please sign in to comment.