Skip to content

Refactor/polygon zone doctest#2264

Merged
Borda merged 3 commits into
roboflow:developfrom
Lourdhu02:refactor/polygon-zone-doctest
Jun 2, 2026
Merged

Refactor/polygon zone doctest#2264
Borda merged 3 commits into
roboflow:developfrom
Lourdhu02:refactor/polygon-zone-doctest

Conversation

@Lourdhu02
Copy link
Copy Markdown
Contributor

Converts the PolygonZone docstring example from a static code block into a runnable doctest using primitive numpy
inputs, following the same pattern as PR #2207 (LineZone).

Type of Change
Refactoring (no functional changes)
Motivation and Context

Part of the documentation-as-tests effort tracked in #2106. The existing docstring example relied on external
dependencies (YOLO, ByteTrack, cv2) and wasn't verifiable. Converting it to a doctest ensures the example stays
correct and is validated by pytest --doctest-modules.

Closes #2106
Changes Made

  • Replaced the static python code block in PolygonZone.init with a pycon doctest
  • Used primitive numpy arrays instead of external model dependencies
  • Example is now executed and verified automatically by pytest

Testing

  • I have tested this code locally
  • All new and existing tests pass

Lourdhu02 and others added 2 commits May 20, 2026 17:14
Replaces the static python code block with a pycon doctest using
primitive numpy inputs, so the example is now executed and verified
by `pytest --doctest-modules`. Removes the external YOLO, ByteTrack,
and cv2 dependencies from the example.

Follows the same pattern as PR roboflow#2207 (LineZone). Part of the
documentation-as-tests effort tracked in roboflow#2106.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Lourdhu02 Lourdhu02 requested a review from SkalskiP as a code owner May 21, 2026 05:09
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78%. Comparing base (81218c5) to head (5fba92d).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2264   +/-   ##
=======================================
  Coverage       78%     78%           
=======================================
  Files           66      66           
  Lines         8416    8416           
=======================================
  Hits          6594    6594           
  Misses        1822    1822           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Borda Borda merged commit 0c67942 into roboflow:develop Jun 2, 2026
26 checks passed
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.

Refactor documentation examples to doctests for continuous validation

3 participants