Skip to content

Commit

Permalink
Tests for deleting fields/trials
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaysraghavan authored Dec 10, 2024
1 parent 7634790 commit 0556cf7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_data_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def test_create_outstruct_from_dict():
assert outstruct['y'][0] == 'y0'
assert outstruct['y'][1] == 'y1'

def test_delete_field_from_outstruct():
data = {'x':[1,2], 'y':[3,4], 'z':[5,6]}
outstruct = Data(data)
del data['z']
assert data.fields == ['x','y']

def test_delete_trial_from_outstruct():
data = {'x':[1,2], 'y':[3,4], 'z':[5,6]}
outstruct = Data(data)
del data[0]
assert data[0] == {'x':[2], 'y':[4], 'z':[6]}

def test_create_outstruct_from_dict_different_lengths():
data = {'x': [np.array([1,2]), np.array([3,4])], 'y': ['y0', 'y1', 'y2']}
with pytest.raises(ValueError):
Expand Down

0 comments on commit 0556cf7

Please sign in to comment.