Skip to content

Commit 86d6c93

Browse files
committed
add tests
1 parent bde9263 commit 86d6c93

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

src/compas/geometry/primitives/circle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __eq__(self, other):
145145
try:
146146
other_plane = other[0]
147147
other_radius = other[1]
148-
except Exception:
148+
except: # noqa: E722
149149
return False
150150
return self.plane == other_plane and self.radius == other_radius
151151

src/compas/geometry/primitives/line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def __eq__(self, other):
147147
try:
148148
other_start = other[0]
149149
other_end = other[1]
150-
except Exception:
150+
except: # noqa: E722
151151
return False
152152
return self.start == other_start and self.end == other_end
153153

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from compas.geometry import Circle
2+
from compas.geometry import Plane # noqa: F401
3+
from compas.geometry import Point # noqa: F401
4+
from compas.geometry import Vector # noqa: F401
5+
6+
7+
def test_circle():
8+
point = [0, 0, 0]
9+
vector = [1, 0, 0]
10+
plane = (point, vector)
11+
c = Circle(plane, 1.0)
12+
assert c.radius == 1.0
13+
assert c.plane == plane
14+
assert c == (plane, 1.0)
15+
assert c == Circle(plane, 1.0)
16+
assert c != 1.0
17+
assert c != (plane, 2.0)
18+
assert c == eval(repr(c))

tests/compas/geometry/test_line.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from compas.geometry import Line
2+
from compas.geometry import Point # noqa: F401
3+
4+
5+
def test_line():
6+
p1 = [0, 0, 0]
7+
p2 = [1, 0, 0]
8+
line = Line(p1, p2)
9+
assert line.start == p1
10+
assert line.end == p2
11+
assert (p1, p2) == line
12+
assert line == Line(p1, p2)
13+
assert line != (p2, p1)
14+
assert line != 1
15+
assert line == eval(repr(line))

0 commit comments

Comments
 (0)