From 3c648102333bfa907eaeac551d32041b06e34966 Mon Sep 17 00:00:00 2001 From: Jacob Kerstetter Date: Wed, 30 Jul 2025 08:35:16 -0400 Subject: [PATCH 1/3] nurbs length test --- tests/test_primitives.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_primitives.py b/tests/test_primitives.py index 99da224f69..b912f0bd81 100644 --- a/tests/test_primitives.py +++ b/tests/test_primitives.py @@ -1583,3 +1583,21 @@ def test_nurbs_curve_contains_point_not_implemented(): # Assert that contains_point raises NotImplementedError with pytest.raises(NotImplementedError, match="contains_point\\(\\) is not implemented."): nurbs_curve.contains_point(point) + + +def test_nurbs_length_calculation(): + """Test the length calculation of a NURBS curve.""" + points = [ + Point3D([0, 0, 0]), + Point3D([2, 2, 0]), + Point3D([-2, 4, 0]), + Point3D([2, 6, 0]) + ] + degree = 3 + nurbs_curve = NURBSCurve.fit_curve_from_points(points, degree) + + # Calculate the length of the NURBS curve + length = nurbs_curve.length() + + # Verify that the length is calculated correctly + assert np.isclose(length, 13.3012277924) \ No newline at end of file From 85546400a897d46699c905917803347da3894305 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:49:40 +0000 Subject: [PATCH 2/3] chore: adding changelog file 2142.test.md [dependabot-skip] --- doc/changelog.d/2142.test.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/2142.test.md diff --git a/doc/changelog.d/2142.test.md b/doc/changelog.d/2142.test.md new file mode 100644 index 0000000000..0b2aee3c58 --- /dev/null +++ b/doc/changelog.d/2142.test.md @@ -0,0 +1 @@ +Nurbs length test \ No newline at end of file From 29dd6713cce6336018c3c044dea2a9fd72e14efd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:49:45 +0000 Subject: [PATCH 3/3] chore: auto fixes from pre-commit hooks --- tests/test_primitives.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/test_primitives.py b/tests/test_primitives.py index b912f0bd81..76200239a4 100644 --- a/tests/test_primitives.py +++ b/tests/test_primitives.py @@ -1587,12 +1587,7 @@ def test_nurbs_curve_contains_point_not_implemented(): def test_nurbs_length_calculation(): """Test the length calculation of a NURBS curve.""" - points = [ - Point3D([0, 0, 0]), - Point3D([2, 2, 0]), - Point3D([-2, 4, 0]), - Point3D([2, 6, 0]) - ] + points = [Point3D([0, 0, 0]), Point3D([2, 2, 0]), Point3D([-2, 4, 0]), Point3D([2, 6, 0])] degree = 3 nurbs_curve = NURBSCurve.fit_curve_from_points(points, degree) @@ -1600,4 +1595,4 @@ def test_nurbs_length_calculation(): length = nurbs_curve.length() # Verify that the length is calculated correctly - assert np.isclose(length, 13.3012277924) \ No newline at end of file + assert np.isclose(length, 13.3012277924)