Skip to content

Commit 5c5638a

Browse files
committed
tweaked a condition so an if statement could be reached, and added a test for value0_nonnans array testing. hopefully coverage will increase
1 parent 22f89e9 commit 5c5638a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

nibabel/cmdline/diff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def are_values_different(*values):
9393
raise
9494

9595
for value in values[1:]:
96-
if type(value0) != type(value): # if types are different, then we consider them different
96+
if value0 is not np.nan and type(value0) != type(value): # if types different, then they different
9797
return True
9898
elif isinstance(value0, np.ndarray):
9999
if value0.dtype != value.dtype or \

nibabel/tests/test_diff.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
from nibabel.cmdline.diff import are_values_different
1414

15-
# TODO: MAJOR TO DO IS TO FIGURE OUT HOW TO USE HYPOTHESIS FOR LONGER LIST LENGTHS WHILE STILL CONTROLLING FOR OUTCOMES
16-
1715

1816
def test_diff_values_int():
1917
large = 10**30
@@ -68,6 +66,7 @@ def test_diff_values_array():
6866
assert not are_values_different(array([nan, 1]), array([nan, 1]))
6967
assert are_values_different(array([nan, nan]), array([nan, 1]))
7068
assert are_values_different(array([0, nan]), array([nan, 0]))
69+
assert are_values_different(array([1, 2, 3, nan]), array([nan, 3, 5, 4]))
7170
# and some inf should not be a problem
7271
assert not are_values_different(array([0, inf]), array([0, inf]))
7372
assert are_values_different(array([0, inf]), array([inf, 0]))

0 commit comments

Comments
 (0)