Fix the Python test suite and the zero-density pipeline - #200
Open
Chessing234 wants to merge 2 commits into
Open
Fix the Python test suite and the zero-density pipeline#200Chessing234 wants to merge 2 commits into
Chessing234 wants to merge 2 commits into
Conversation
tests/test_affine2.py imported large_values.max_of, which was deleted in "Remove redundant code" (Oct 2024) along with the rest of the affine max machinery. The import has raised ImportError ever since, and test_all.py imports this module first, so `python tests/test_all.py` never reached a single assertion. Rebuild the same edge case against the machinery that survived: fold the five affine functions with Piecewise.min_with over the same region, check the pieces tile it without overlap, and cross-check every sample point against the naive minimum.
try_union is documented to return None when the union of its inputs is not a polytope, and Region._as_disjoint_union_poly relies on that: it tries to merge a group of pieces and keeps them separate when the merge fails. Raising on an unbounded input therefore aborts the caller instead of degrading, and lv_zlv_to_zd - the main zero-density pipeline - dies part-way through with "only supports finite polytopes". Return None for those inputs instead, and assert that in the two union tests. The envelope is still never wrong, since the vertex-only feasibility checks cannot see extreme rays. run_union_test also called try_union on an unbounded pair and dropped the result, which is what aborted the whole test module.
Chessing234
force-pushed
the
fix-python-test-suite
branch
from
August 16, 2026 15:39
a77ac65 to
8cc5c0a
Compare
This was referenced Aug 16, 2026
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.
Two things are broken on main, both easy to hit.
python tests/test_all.pynever reaches an assertion.tests/test_affine2.pyimportslarge_values.max_of, removed in "Remove redundant code" (Oct 2024) along with the affine max machinery, andtest_all.pyimports that module first. I rebuilt the same edge case against what survived —Affine2/Piecewise.min_with— with a value check against the naive minimum, so it still tests something.lv_zlv_to_zdcrashes part-way through. #194 madetry_unionraise on an input with extreme rays. ButRegion._as_disjoint_union_polyusestry_unionas a merge attempt and relies on the documentedNonereturn to keep the pieces separate, so the raise aborts the caller instead of degrading. ReturningNonethere restores the pipeline and still never produces a wrong envelope. That same raise also abortedrun_union_test, which callstry_unionon an unbounded pair and drops the result.Evidence, on python 3.13 with
pycddlib<3:python tests/test_all.pystops at thetest_affine2import; after: reaches "All test cases passed."raises
ValueError: Polytope.try_union only supports finite polytopes; with this branch it returnsA(x) \leq 7/6 - x/3 on [1/2,1).