Skip to content

Commit 4f76eaf

Browse files
committed
waltsims#406: added further tests for coverage.
1 parent e9a6b16 commit 4f76eaf

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/test_element.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
from kwave.utils.kwave_array import Element
55

66

7+
def test_element_equality_type_error():
8+
element = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[1, 1, 1])
9+
10+
with pytest.raises(TypeError, match=r"not an element with <class 'str'> is not of type Element"):
11+
element == "not an element"
12+
13+
14+
def test_element_equality_is_true():
15+
element1 = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[1, 1, 1])
16+
element2 = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[1, 1, 1])
17+
assert element1 == element2
18+
19+
20+
def test_element_equality_is_false():
21+
element1 = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[1, 1, 1])
22+
element2 = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[2, 2, 2])
23+
assert element1 != element2
24+
25+
726
def test_element_is_approximately_equal():
827
base_element = Element(group_id=0, type="rect", dim=2, active=True, measure=1, position=[1, 1, 1])
928

0 commit comments

Comments
 (0)