Skip to content

Commit

Permalink
Improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Feb 11, 2024
1 parent 6737bbb commit 0ac4663
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion named_arrays/_functions/function_named_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def pcolormesh(
**kwargs,
) -> na.ScalarArray:

if len(XY) != 0:
if len(XY) != 0: # pragma: nocover
raise ValueError(
"if `C` is an instance of `na.AbstractFunctionArray`, "
"`XY` must not be specified."
Expand Down
10 changes: 0 additions & 10 deletions named_arrays/_functions/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,21 +667,11 @@ def test_pcolormesh(
na.plt.pcolormesh(**kwargs)
return

if any(isinstance(array.inputs.components[c], na.AbstractUncertainScalarArray) for c in components):
with pytest.raises(TypeError):
na.plt.pcolormesh(**kwargs)
return

if axis_rgb is not None:
with pytest.raises(ValueError):
na.plt.pcolormesh(**kwargs)
return

if array.ndim != 2:
with pytest.raises(ValueError):
na.plt.pcolormesh(**kwargs)
return

result = na.plt.pcolormesh(**kwargs)
assert isinstance(result, na.ScalarArray)

Expand Down
2 changes: 1 addition & 1 deletion named_arrays/_scalars/scalar_named_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def pcolormesh(
**kwargs,
) -> na.ScalarArray:

if components is not None:
if components is not None: # pragma: nocover
raise ValueError(f"`components` should be `None` for scalars, got {components}")

try:
Expand Down
2 changes: 1 addition & 1 deletion named_arrays/_vectors/vector_named_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def pcolormesh(
except na.VectorTypeError:
return NotImplemented

Check warning on line 292 in named_arrays/_vectors/vector_named_array_functions.py

View check run for this annotation

Codecov / codecov/patch

named_arrays/_vectors/vector_named_array_functions.py#L291-L292

Added lines #L291 - L292 were not covered by tests

if len(XY) != 1:
if len(XY) != 1: # pragma: nocover
raise ValueError("if any element of `XY` is a vector, `XY` must have a length of 1")
XY = XY[0]

Expand Down

0 comments on commit 0ac4663

Please sign in to comment.