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

Method testPopPending

tests/test_cadquery.py:5031–5069  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5029 w0.cutBlind(1)
5030
5031 def testPopPending(self):
5032 # test pending edges
5033 w0 = Workplane().hLine(1)
5034 self.assertEqual(len(w0.ctx.pendingEdges), 1)
5035 edges = w0.ctx.popPendingEdges()
5036 self.assertEqual(len(edges), 1)
5037 self.assertEqual(edges[0], w0.val())
5038 # pending edges should now be cleared
5039 self.assertEqual(len(w0.ctx.pendingEdges), 0)
5040
5041 # test pending wires
5042 w1 = Workplane().hLine(1).vLine(1).close()
5043 wire = w1.val()
5044 self.assertEqual(w1.ctx.pendingWires[0], wire)
5045 pop_pending_output = w1.ctx.popPendingWires()
5046 self.assertEqual(pop_pending_output[0], wire)
5047 # pending wires should now be cleared
5048 self.assertEqual(len(w1.ctx.pendingWires), 0)
5049
5050 # test error when empty pending edges
5051 w2 = Workplane()
5052 # the following 2 should not raise an exception
5053 w2.ctx.popPendingEdges(errorOnEmpty=False)
5054 w2.ctx.popPendingWires(errorOnEmpty=False)
5055
5056 # empty edges
5057 w3 = Workplane().hLine(1).vLine(1).close()
5058 with self.assertRaises(ValueError):
5059 w3.ctx.popPendingEdges()
5060
5061 # empty wires
5062 w4 = Workplane().circle(1).extrude(1)
5063 with self.assertRaises(ValueError):
5064 w4.ctx.popPendingWires()
5065
5066 # test via cutBlind
5067 w5 = Workplane().circle(1).extrude(1)
5068 with self.assertRaises(ValueError):
5069 w5.cutBlind(-1)
5070
5071 def testCompSolid(self):
5072

Callers

nothing calls this directly

Calls 10

WorkplaneClass · 0.85
hLineMethod · 0.80
popPendingEdgesMethod · 0.80
vLineMethod · 0.80
popPendingWiresMethod · 0.80
extrudeMethod · 0.80
cutBlindMethod · 0.80
valMethod · 0.45
closeMethod · 0.45
circleMethod · 0.45

Tested by

no test coverage detected