Skip to content

Commit 10ae26c

Browse files
committed
Slightly improved testing
1 parent b7087e9 commit 10ae26c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/test_geometry.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ def test_line_length():
653653
assert line.length == sqrt(2)
654654

655655

656+
def test_line_get_coordinate_distance():
657+
line = geometry.Line(geometry.Coordinate(0, 0), geometry.Coordinate(0, 2))
658+
point = Coordinate(1, 1)
659+
assert line.get_coordinate_distance(point) == 1
660+
661+
656662
def test_arc_get_coordinate_from_fractional_distance():
657663
arc = geometry.Arc(
658664
geometry.Coordinate(-1, 0), geometry.Coordinate(1, 0), geometry.Coordinate(0, 0), 1

tests/test_geometry_tree.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ def test_get_tree(sample_tree):
130130
def test_get_node(sample_tree):
131131
assert sample_tree.get_node("rotor") == sample_tree["Rotor"]
132132

133+
with pytest.raises(TypeError) as e_info:
134+
sample_tree.get_node(5)
135+
136+
assert "key must be a string or GeometryNode" in str(e_info.value)
137+
133138

134139
def test_tostring(sample_tree):
135140
# Test that all nodes are, at the least, present in the string representation

0 commit comments

Comments
 (0)