Add pytest suite, CI workflow, and hygiene fixes - #1
Merged
Conversation
- tests/test_core.py: brute-force oracle check for carmichael_lambda, semiprime gcd identity, invariant-factor structure cross-checked against actual element orders, Korselt criterion vs known Carmichael numbers below 10^4, and the THEOREM.md worked propagation examples - .github/workflows/ci.yml: run pytest on push and pull request - gcd_distribution_theory.py: fix stale module docstring (the mean-gcd heuristic is sum 1/phi(d) ~ A log D, not a convergent sum 1/phi(d)^2) - .gitignore: ignore runs/ output dir and pytest cache, fix missing trailing newline Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01898JobGjDfsgm93YW6jH6s
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.
Summary
Follow-up from a repo state review: the core library was very testable but had no test suite or CI. This PR adds both, plus two small hygiene fixes. No library code changes.
tests/test_core.py(pytest, 4278 tests via parametrization):carmichael_lambdafast path checked against the existingmethod="brute"oracle for n = 1..150C(p·q) = gcd(p−1, q−1)over odd-prime pairsinvariant_factors: sortedness, divisibility chain, product = φ(n), last factor = λ(n) for n = 2..299; order histograms of the abstract cyclic-product cross-checked against actualelement_ordersfor selected nis_carmichaelagainst the known list below 10⁴ (561, 1105, 1729, 2465, 2821, 6601, 8911) and against the λ(n) | n−1 criterion for n < 3000collapse_propagation_tracereproduces the THEOREM.md worked examples (1365 → C=48, 1729 → C=36), order-independence, and error cases.github/workflows/ci.yml: runs pytest on push and pull request (stdlib-only imports, so no matplotlib needed in CI)gcd_distribution_theory.py: fixed a stale module docstring — the mean-gcd heuristic issum 1/phi(d) ~ A·log D(as the code and THEOREM.md state), not a convergentsum 1/phi(d)^2.gitignore: addedruns/(the README CLI example's output dir) and pytest cache; fixed missing trailing newlineVerification
pytest tests/ -q— 4278 passed in ~4swedge_envelopes.py,order_distributions.py,propagation.py,group_structure.py,gcd_distribution_theory.py) run without error; committed PNGs left untouchedpython lambda_ratio_explorer.py --q-max 20) works🤖 Generated with Claude Code
https://claude.ai/code/session_01898JobGjDfsgm93YW6jH6s
Generated by Claude Code