Skip to content

Commit

Permalink
unit test for bad view axis attr
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Sep 18, 2023
1 parent d4eecdb commit 749ca98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmeutils/tests/test_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def test_set_bad_frame(self, p3ht_fresnel):
with pytest.raises(ValueError):
p3ht_fresnel.frame = 10

def test_set_bad_view(self, p3ht_fresnel):
with pytest.raises(ValueError):
p3ht_fresnel.view_axis = 10

def test_bad_color_dict(self, p3ht_fresnel):
with pytest.raises(ValueError):
p3ht_fresnel.color_dict = np.array([0.1, 0.1, 0.1])
Expand Down
2 changes: 1 addition & 1 deletion cmeutils/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def view_axis(self):
def view_axis(self, value):
# TODO Assert is 1,3 array
new_view_axis = np.asarray(value)
if len(new_view_axis) != 0:
if new_view_axis.shape != (3,):
raise ValueError("View axis must be a 3x1 array")
self._view_axis = np.asarray(new_view_axis)

Expand Down

0 comments on commit 749ca98

Please sign in to comment.