Skip to content

Commit f3c7a1f

Browse files
committed
add test for returning NaN in int array
1 parent 352f0f4 commit f3c7a1f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/navdata/test_navdata.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,3 +1704,20 @@ def test_keep_cols_where(data, df_simple):
17041704

17051705
df_simple_subset = df_simple_subset.reset_index(drop=True)
17061706
pd.testing.assert_frame_equal(data_subset.pandas_df(), df_simple_subset, check_dtype=False)
1707+
1708+
def test_nan_return():
1709+
"""Test case where NaN values in int array need to be returned.
1710+
1711+
"""
1712+
navdata = NavData()
1713+
int_values = np.array([1,2,3,4,5]).astype(np.int64)
1714+
navdata["x"] = int_values
1715+
navdata.array[0,1] = np.nan
1716+
navdata.array[0,3] = np.nan
1717+
1718+
pd_df = navdata.pandas_df()
1719+
assert pd.isnull(pd_df).values.sum() == 2
1720+
1721+
x_output = navdata["x"]
1722+
np.testing.assert_array_equal(np.isnan(x_output),
1723+
np.array([False, True, False, True, False]))

0 commit comments

Comments
 (0)