File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ Adding test for nurbs sketching
Original file line number Diff line number Diff line change 4848 Slot ,
4949 SpurGear ,
5050 Triangle ,
51+ nurbs ,
5152)
5253
5354from .conftest import are_graphics_available
@@ -369,6 +370,33 @@ def test_sketch_nurbs():
369370 assert not sketch .edges [0 ].contains_point (Point2D ([5 , 5 ]))
370371
371372
373+ def test_sketch_nurbs_misc ():
374+ """Test NURBS Sketch for code coverage"""
375+ control_points = [
376+ Point2D ([0.0 , 0.0 ]),
377+ Point2D ([1.0 , 2.0 ]),
378+ Point2D ([2.0 , 0.0 ]),
379+ Point2D ([3.0 , 3.0 ]),
380+ ]
381+ # Checking geomdl_nurbs_curve usage
382+ nurbs_curve = nurbs .SketchNurbs .fit_curve_from_points (points = control_points , degree = 3 )
383+ assert nurbs_curve .geomdl_nurbs_curve .ctrlpts [0 ][0 ] == 0.0
384+ # Checking value error for degrees less than 1
385+ with pytest .raises (
386+ ValueError ,
387+ match = "Degree must be at least 1" ,
388+ ):
389+ nurbs .SketchNurbs .fit_curve_from_points (points = control_points , degree = 0 )
390+ # Checking Force linear interpolation
391+ control_points = [
392+ Point2D ([0.0 , 0.0 ]),
393+ Point2D ([1.0 , 1.0 ]),
394+ ]
395+ nurbs_curve = nurbs .SketchNurbs .fit_curve_from_points (points = control_points )
396+ assert nurbs_curve .control_points [0 ].x == 0.0
397+ assert nurbs_curve .degree == 1
398+
399+
372400def test_sketch_triangle_face ():
373401 """Test Triangle SketchFace sketching."""
374402 # Create a Sketch instance
You can’t perform that action at this time.
0 commit comments