Skip to content

Commit 12f3abd

Browse files
committed
Updated tests and use of num_cols
1 parent 87b3e31 commit 12f3abd

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

gnss_lib_py/navdata/navdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ def __next__(self):
898898
x_curr : gnss_lib_py.navdata.navdata.NavData
899899
Current column (based on iteration count)
900900
"""
901-
if self.curr_col >= self.num_cols:
901+
if self.curr_col >= len(self):
902902
raise StopIteration
903903
x_curr = self.copy(rows=None, cols=self.curr_col)
904904
self.curr_col += 1

tests/navdata/test_navdata.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,28 @@ def test_init_np(numpy_array):
176176
data = NavData(numpy_array=pd.DataFrame([0]))
177177

178178

179-
def test_len_num_cols_rows(data):
179+
def test_len_rows(data):
180+
"""Test that `len()` and `rows` return correct output.
181+
182+
Parameters
183+
----------
184+
data : gnss_lib_py.navdata.navdata.NavData
185+
Simple version of NavData to use for test.
186+
"""
180187
assert len(data) == 6
181-
assert data.num_cols == len(data)
182188
assert data.rows == ['names', 'integers', 'floats', 'strings']
183189

184190

191+
def test_num_cols(data):
192+
"""Test that `num_cols` returns correct output.
193+
194+
Parameters
195+
----------
196+
data : gnss_lib_py.navdata.navdata.NavData
197+
Simple version of NavData to use for test."""
198+
assert data.num_cols == 6
199+
200+
185201

186202
@pytest.mark.parametrize('pandas_df',
187203
[

0 commit comments

Comments
 (0)