@@ -328,25 +328,40 @@ def test_slot_center_point(self):
328328 self .assertEqual (s .faces ()[0 ].normal_at (), Vector (0 , 0 , 1 ))
329329
330330 def test_slot_center_to_center (self ):
331+ height = 2
331332 with BuildSketch () as test :
332- s = SlotCenterToCenter (4 , 2 )
333+ s = SlotCenterToCenter (4 , height )
333334 self .assertEqual (s .center_separation , 4 )
334- self .assertEqual (s .slot_height , 2 )
335+ self .assertEqual (s .slot_height , height )
335336 self .assertEqual (s .rotation , 0 )
336337 self .assertEqual (s .mode , Mode .ADD )
337- self .assertAlmostEqual (test .sketch .area , pi + 4 * 2 , 5 )
338+ self .assertAlmostEqual (test .sketch .area , pi + 4 * height , 5 )
338339 self .assertEqual (s .faces ()[0 ].normal_at (), Vector (0 , 0 , 1 ))
339340
341+ # Circle degenerate
342+ s1 = SlotCenterToCenter (0 , height )
343+ self .assertTrue (len (s1 .edges ()) == 1 )
344+ self .assertEqual (s1 .edge ().geom_type , GeomType .CIRCLE )
345+ self .assertAlmostEqual (s1 .edge ().radius , height / 2 )
346+
347+
340348 def test_slot_overall (self ):
349+ height = 2
341350 with BuildSketch () as test :
342- s = SlotOverall (6 , 2 )
351+ s = SlotOverall (6 , height )
343352 self .assertEqual (s .width , 6 )
344- self .assertEqual (s .slot_height , 2 )
353+ self .assertEqual (s .slot_height , height )
345354 self .assertEqual (s .rotation , 0 )
346355 self .assertEqual (s .mode , Mode .ADD )
347- self .assertAlmostEqual (test .sketch .area , pi + 4 * 2 , 5 )
356+ self .assertAlmostEqual (test .sketch .area , pi + 4 * height , 5 )
348357 self .assertEqual (s .faces ()[0 ].normal_at (), Vector (0 , 0 , 1 ))
349358
359+ # Circle degenerat
360+ s1 = SlotOverall (2 , height )
361+ self .assertTrue (len (s1 .edges ()) == 1 )
362+ self .assertEqual (s1 .edge ().geom_type , GeomType .CIRCLE )
363+ self .assertAlmostEqual (s1 .edge ().radius , height / 2 )
364+
350365 def test_text (self ):
351366 with BuildSketch () as test :
352367 t = Text ("test" , 2 )
@@ -530,7 +545,7 @@ def test_full_round(self):
530545@pytest .mark .parametrize (
531546 "slot,args" ,
532547 [
533- (SlotOverall , (5 , 10 )),
548+ (SlotOverall , (9 , 10 )),
534549 (SlotCenterToCenter , (- 1 , 10 )),
535550 (SlotCenterPoint , ((0 , 0 , 0 ), (0 , 0 , 0 ), 10 )),
536551 ],
0 commit comments