MCPcopy
hub / github.com/CadQuery/cadquery / test_utils

Function test_utils

tests/test_free_functions.py:107–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105
106
107def test_utils():
108
109 r1 = _get_one_wire(rect(1, 1))
110
111 assert r1.ShapeType() == "Wire"
112
113 r2 = list(_get_wires(compound(r1, r1.moved(Location(0, 0, 1)))))
114
115 assert len(r2) == 2
116 assert all(el.ShapeType() == "Wire" for el in r2)
117
118 with raises(ValueError):
119 list(_get_wires(box(1, 1, 1)))
120
121 r3 = list(_get(box(1, 1, 1).moved(Location(), Location(2, 0, 0)), "Solid"))
122
123 assert (len(r3)) == 2
124 assert all(el.ShapeType() == "Solid" for el in r3)
125
126 with raises(ValueError):
127 list(_get(box(1, 1, 1), "Shell"))
128
129 r4 = _get_one(compound(box(1, 1, 1), box(2, 2, 2)), "Solid")
130
131 assert r4.ShapeType() == "Solid"
132
133 with raises(ValueError):
134 _get_one(rect(1, 1), ("Solid", "Shell"))
135
136 with raises(ValueError):
137 list(_get_edges(fill(circle(1))))
138
139 r5 = _get_faces(plane(1, 1), rect(1, 1), circle(1.0), compound(circle(1.0)))
140
141 assert len(list(r5)) == 4
142
143 with raises(ValueError):
144 list(_get_faces(vertex(0, 0, 0)))
145
146
147def test_adaptor_curve_to_edge():

Callers

nothing calls this directly

Calls 15

_get_one_wireFunction · 0.90
_get_wiresFunction · 0.90
_getFunction · 0.90
_get_oneFunction · 0.90
_get_edgesFunction · 0.90
_get_facesFunction · 0.90
rectFunction · 0.85
compoundFunction · 0.85
LocationClass · 0.85
boxFunction · 0.85
fillFunction · 0.85
circleFunction · 0.85

Tested by

no test coverage detected