File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 11from compas .geometry import Circle
2+ # These imports are used to check __repr__.
23from compas .geometry import Plane # noqa: F401
34from compas .geometry import Point # noqa: F401
45from compas .geometry import Vector # noqa: F401
@@ -11,8 +12,31 @@ def test_circle():
1112 c = Circle (plane , 1.0 )
1213 assert c .radius == 1.0
1314 assert c .plane == plane
15+
16+
17+ def test_equality ():
18+ point = [0 , 0 , 0 ]
19+ vector = [1 , 0 , 0 ]
20+ plane = (point , vector )
21+ c = Circle (plane , 1.0 )
1422 assert c == (plane , 1.0 )
1523 assert c == Circle (plane , 1.0 )
1624 assert c != 1.0
1725 assert c != (plane , 2.0 )
26+
27+
28+ def test___repr__ ():
29+ point = [0 , 0 , 0 ]
30+ vector = [1 , 0 , 0 ]
31+ plane = (point , vector )
32+ c = Circle (plane , 1.0 )
1833 assert c == eval (repr (c ))
34+
35+
36+ def test___getitem__ ():
37+ point = [0 , 0 , 0 ]
38+ vector = [1 , 0 , 0 ]
39+ plane = (point , vector )
40+ c = Circle (plane , 1.0 )
41+ assert c [0 ] == plane
42+ assert c [1 ] == 1.0
Original file line number Diff line number Diff line change 11from compas .geometry import Line
2+ # This import is use to test __repr__.
23from compas .geometry import Point # noqa: F401
34
45
@@ -8,8 +9,28 @@ def test_line():
89 line = Line (p1 , p2 )
910 assert line .start == p1
1011 assert line .end == p2
12+
13+
14+ def test_equality ():
15+ p1 = [0 , 0 , 0 ]
16+ p2 = [1 , 0 , 0 ]
17+ line = Line (p1 , p2 )
1118 assert (p1 , p2 ) == line
1219 assert line == Line (p1 , p2 )
1320 assert line != (p2 , p1 )
1421 assert line != 1
22+
23+
24+ def test___repr__ ():
25+ p1 = [0 , 0 , 0 ]
26+ p2 = [1 , 0 , 0 ]
27+ line = Line (p1 , p2 )
1528 assert line == eval (repr (line ))
29+
30+
31+ def test___getitem__ ():
32+ p1 = [0 , 0 , 0 ]
33+ p2 = [1 , 0 , 0 ]
34+ line = Line (p1 , p2 )
35+ assert line [0 ] == p1
36+ assert line [1 ] == p2
You can’t perform that action at this time.
0 commit comments