Repository navigation
R23-T051: Hypothesis property tests and boundary doctests for points_are_collinear_3d - #61
Open
code-paul-creator wants to merge 1 commit into
Open
code-paul-creator wants to merge 1 commit into
code-paul-creator wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds Hypothesis property-based tests for
maths/points_are_collinear_3d.pyand 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 theaccuracyrounding decides the result near the boundary.Related Issue
Fixes: #6
Type of Change
Changes Made
work/R23-T051/test_points_are_collinear_3d_properties.pywith 3 Hypothesis tests (2000 examples each): exact integer collinearity, float collinearity (accuracy=6), and perturbed points not collinear.work/R23-T051/PROPERTIES.mdexplaining each property and the findings.are_collinearinmaths/points_are_collinear_3d.pyfor nearly-collinear points at differentaccuracyvalues.Screenshots / Recordings
Not applicable (no UI changes).
Testing
python -m pytest work/R23-T051/ -v-> 3 passedpython -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-> passedruff check maths/points_are_collinear_3d.py-> all checks passedChecklist
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. Seework/R23-T051/PROPERTIES.md.