Skip to content

R23-T051: Hypothesis property tests and boundary doctests for points_are_collinear_3d - #61

Open
code-paul-creator wants to merge 1 commit into
S-AI-Projects:masterfrom
code-paul-creator:R23-T051
Open

code-paul-creator wants to merge 1 commit into
S-AI-Projects:masterfrom
code-paul-creator:R23-T051

Conversation

@code-paul-creator

@code-paul-creator code-paul-creator commented Nov 9, 2026 •

Copy link
Copy Markdown

Description

Adds Hypothesis property-based tests for maths/points_are_collinear_3d.py and new doctests for nearly-collinear points. The property tests check that B = A + t·v and C = A + s·v are always collinear, and that points moved off the line are not. The doctests document how the accuracy rounding decides the result near the boundary.

Related Issue

Fixes: #6

Type of Change

  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Tests
  • Documentation
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Added work/R23-T051/test_points_are_collinear_3d_properties.py with 3 Hypothesis tests (2000 examples each): exact integer collinearity, float collinearity (accuracy=6), and perturbed points not collinear.
  • Added work/R23-T051/PROPERTIES.md explaining each property and the findings.
  • Added 4 doctests to are_collinear in maths/points_are_collinear_3d.py for nearly-collinear points at different accuracy values.

Screenshots / Recordings

Not applicable (no UI changes).

Testing

  • python -m pytest work/R23-T051/ -v -> 3 passed
  • python -m doctest -v maths/points_are_collinear_3d.py -> 18 passed (14 existing + 4 new)
  • python -m pytest --doctest-modules maths/points_are_collinear_3d.py -> passed
  • ruff check maths/points_are_collinear_3d.py -> all checks passed

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.

Additional Notes

Findings: Hypothesis found no failing inputs. The result depends on accuracy, e.g. (0,0,0), (1,0,0), (2,1e-6,0) is False at accuracy=10 but True at accuracy=5. The check uses an absolute tolerance, so very large or very small coordinates can be misjudged. See work/R23-T051/PROPERTIES.md.

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.

Paulami Bhosle — R23-T051: Property tests for maths/points_are_collinear_3d.py

1 participant