Skip to content

Test Sketch.bezier without a preceding edge (closes #1637) - #2123

Open
juw12 wants to merge 1 commit into
CadQuery:masterfrom
juw12:test-sketch-bezier-standalone
Open

juw12 wants to merge 1 commit into
CadQuery:masterfrom
juw12:test-sketch-bezier-standalone

Conversation

@juw12

@juw12 juw12 commented Nov 4, 2026

Copy link
Copy Markdown

Closes #1637.

Sketch.bezier used to call self._endPoint() before building the curve, so it raised when the sketch had no edges yet. That call has since been removed (the curve is built only from the given points), but the issue is still open and nothing tests the case, so a regression could come back unnoticed.

This adds test_bezier_without_prior_edge, which checks that:

  • a closed profile made only of two cubic beziers, with no preceding segment, assembles into one face;
  • its area matches the analytic value: each half encloses (\int_0^1 y,x',dt = 36\int_0^1 t^2(1-t)^2,dt = 1.2), so the total is 2.4;
  • a single standalone bezier creates one edge whose end points are the first and last control points.

Test only, no library changes. pytest tests/test_sketch.py passes locally (37 passed) on current master with cadquery-ocp 8.0.1.1.0, Python 3.13, Windows.

I used an AI assistant to help find the issue and draft the test; I checked the math and ran the suite myself.

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.81%. Comparing base (8178185) to head (fefa822).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2123   +/-   ##
=======================================
  Coverage   95.81%   95.81%           
=======================================
  Files          30       30           
  Lines        9605     9605           
  Branches     1443     1443           
=======================================
  Hits         9203     9203           
  Misses        247      247           
  Partials      155      155           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot create a free standing bezier curve

1 participant