@@ -4255,3 +4255,38 @@ def testFindFace(self):
4255
4255
self .assertTrue (isinstance (w2 .findFace (searchParents = True ), Face ))
4256
4256
with raises (ValueError ):
4257
4257
w2 .findFace (searchParents = False )
4258
+
4259
+ def testPopPending (self ):
4260
+ # test pending edges
4261
+ w0 = Workplane ().hLine (1 )
4262
+ self .assertEqual (len (w0 .ctx .pendingEdges ), 1 )
4263
+ edges = w0 .ctx .popPendingEdges ()
4264
+ self .assertEqual (len (edges ), 1 )
4265
+ self .assertEqual (edges [0 ], w0 .val ())
4266
+ # pending edges should now be cleared
4267
+ self .assertEqual (len (w0 .ctx .pendingEdges ), 0 )
4268
+
4269
+ # test pending wires
4270
+ w1 = Workplane ().hLine (1 ).vLine (1 ).close ()
4271
+ wire = w1 .val ()
4272
+ self .assertEqual (w1 .ctx .pendingWires [0 ], wire )
4273
+ pop_pending_output = w1 .ctx .popPendingWires ()
4274
+ self .assertEqual (pop_pending_output [0 ], wire )
4275
+ # pending wires should now be cleared
4276
+ self .assertEqual (len (w1 .ctx .pendingWires ), 0 )
4277
+
4278
+ # test error when empty pending edges
4279
+ w2 = Workplane ()
4280
+ # the following 2 should not raise an exception
4281
+ w2 .ctx .popPendingEdges (errorOnEmpty = False )
4282
+ w2 .ctx .popPendingWires (errorOnEmpty = False )
4283
+
4284
+ # empty edges
4285
+ w3 = Workplane ().hLine (1 ).vLine (1 ).close ()
4286
+ with self .assertRaises (ValueError ):
4287
+ w3 .ctx .popPendingEdges ()
4288
+
4289
+ # empty wires
4290
+ w4 = Workplane ().circle (1 ).extrude (1 )
4291
+ with self .assertRaises (ValueError ):
4292
+ w4 .ctx .popPendingWires ()
0 commit comments