-
Notifications
You must be signed in to change notification settings - Fork 3
fix: the latest PR broke the package by introducing Python 3.13-only … #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ee0b9db
fix: the latest PR broke the package by introducing Python 3.13-only …
d-krupke 5f0f395
chores: ruff
d-krupke 58131b8
fix: more typing fixes
d-krupke dc50102
tests: adding some more tests
d-krupke 6b8c6c4
tests: adding some more tests
d-krupke 723fef6
Update src/cgshop2026_pyutils/geometry/_bindings.pyi
d-krupke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
7 changes: 6 additions & 1 deletion
7
src/cgshop2026_pyutils/instance_database/instance_file_database.py
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| """ | ||
| Test that all modules can be imported successfully. | ||
| This catches compatibility issues with typing features across Python versions. | ||
| """ | ||
|
|
||
| import sys | ||
| import pytest | ||
|
|
||
|
|
||
| def test_python_version(): | ||
| """Verify we're running on supported Python version.""" | ||
| assert sys.version_info >= (3, 10), "Python 3.10+ required" | ||
|
|
||
|
|
||
| def test_import_geometry_module(): | ||
| """Test that the main geometry module imports successfully.""" | ||
| from cgshop2026_pyutils import geometry | ||
| assert geometry is not None | ||
|
|
||
|
|
||
| def test_import_geometry_classes(): | ||
| """Test that key geometry classes can be imported.""" | ||
| from cgshop2026_pyutils.geometry import ( | ||
| Point, | ||
| Segment, | ||
| FlippableTriangulation, | ||
| FlipPartnerMap, | ||
| is_triangulation, | ||
| compute_triangles, | ||
| do_cross, | ||
| ) | ||
| assert Point is not None | ||
| assert Segment is not None | ||
| assert FlippableTriangulation is not None | ||
| assert FlipPartnerMap is not None | ||
| assert is_triangulation is not None | ||
| assert compute_triangles is not None | ||
| assert do_cross is not None | ||
|
|
||
|
|
||
| def test_import_schemas(): | ||
| """Test that schema classes can be imported.""" | ||
| from cgshop2026_pyutils.schemas import ( | ||
| CGSHOP2026Instance, | ||
| CGSHOP2026Solution, | ||
| ) | ||
| assert CGSHOP2026Instance is not None | ||
| assert CGSHOP2026Solution is not None | ||
|
|
||
|
|
||
| def test_import_io(): | ||
| """Test that IO functions can be imported.""" | ||
| from cgshop2026_pyutils.io import ( | ||
| read_instance, | ||
| read_solution, | ||
| ) | ||
| assert read_instance is not None | ||
| assert read_solution is not None | ||
|
|
||
|
|
||
| def test_import_verify(): | ||
| """Test that verification module can be imported.""" | ||
| from cgshop2026_pyutils.verify import check_for_errors | ||
| assert check_for_errors is not None | ||
|
|
||
|
|
||
| def test_import_zip_utilities(): | ||
| """Test that ZIP utilities can be imported.""" | ||
| from cgshop2026_pyutils.zip import ( | ||
| ZipSolutionIterator, | ||
| ZipWriter, | ||
| ) | ||
| assert ZipSolutionIterator is not None | ||
| assert ZipWriter is not None | ||
|
|
||
|
|
||
| def test_import_instance_database(): | ||
| """Test that instance database classes can be imported.""" | ||
| from cgshop2026_pyutils.instance_database import InstanceDatabase | ||
| assert InstanceDatabase is not None | ||
|
|
||
|
|
||
| def test_typing_extensions_compatibility(): | ||
| """Test that typing features work correctly across Python versions.""" | ||
| # This test ensures override and Self are available | ||
| if sys.version_info >= (3, 12): | ||
| from typing import override | ||
| else: | ||
| from typing_extensions import override | ||
|
|
||
| if sys.version_info >= (3, 11): | ||
| from typing import Self | ||
| else: | ||
| from typing_extensions import Self | ||
|
|
||
| assert override is not None | ||
| assert Self is not None | ||
|
|
||
|
|
||
| def test_override_decorator_usage(): | ||
| """Test that @override decorator works in actual classes.""" | ||
| from cgshop2026_pyutils.geometry import FlippableTriangulation | ||
| from cgshop2026_pyutils.zip import ZipSolutionIterator | ||
|
|
||
| # Just verify these classes can be instantiated (basic smoke test) | ||
| # The fact they import successfully means @override is working | ||
| assert FlippableTriangulation is not None | ||
| assert ZipSolutionIterator is not None | ||
|
|
||
|
|
||
| def test_bindings_module_types(): | ||
| """Test that C++ binding types are available.""" | ||
| from cgshop2026_pyutils.geometry._bindings import ( | ||
| Point, | ||
| Segment, | ||
| FieldNumber, | ||
| ) | ||
|
|
||
| # Test basic type instantiation | ||
| p = Point(0, 0) | ||
| assert p is not None | ||
|
|
||
| fn = FieldNumber(42) | ||
| assert fn is not None | ||
|
|
||
| s = Segment(Point(0, 0), Point(1, 1)) | ||
| assert s is not None | ||
|
|
||
|
|
||
| def test_create_simple_triangulation(): | ||
| """Smoke test: create a simple triangulation to ensure everything works.""" | ||
| from cgshop2026_pyutils.geometry import Point, is_triangulation | ||
|
|
||
| # Simple triangle | ||
| points = [Point(0, 0), Point(1, 0), Point(0, 1)] | ||
| edges = [(0, 1), (1, 2), (2, 0)] | ||
|
|
||
| result = is_triangulation(points, edges, verbose=False) | ||
| assert result is True | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| # Allow running this test file directly | ||
| pytest.main([__file__, "-v"]) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import ordering violates PEP 8 conventions. The
from collections.abc import Iteratorimport should come before the conditionaltyping_extensionsimport block. Standard library imports should be grouped together at the top, followed by third-party imports, then local imports.Suggested order: