Add more python integration tests + fix pre-commit ruff-format#8
Add more python integration tests + fix pre-commit ruff-format#8jiayuasu merged 15 commits intoapache:mainfrom
Conversation
87dfaff to
d5fd475
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive integration tests for several PostGIS/SedonaDB spatial functions and fixes a pre-commit configuration issue. The changes include moving st_dwithin tests to the appropriate predicates file and adding new tests for buffer, binary conversion, and WKB functions.
- Reorganized st_dwithin test location from functions to predicates module
- Added integration tests for st_buffer, st_asbinary, st_geogfromwkb, and st_geomfromwkb functions
- Fixed duplicate ruff-format entry in pre-commit configuration that was causing conflicts
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/sedonadb/tests/functions/test_predicates.py | Added st_dwithin test cases and imported val_or_null helper |
| python/sedonadb/tests/functions/test_functions.py | Added new function tests (st_buffer, st_asbinary, st_astext, st_geogfromwkb, st_geomfromwkb) and removed duplicate st_dwithin tests |
| python/sedonadb/python/sedonadb/testing.py | Enhanced testing utilities with binary data support and improved float comparison |
| .pre-commit-config.yaml | Removed duplicate ruff-format configuration entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.1.5 | ||
| hooks: | ||
| - id: ruff | ||
| args: [ --fix ] | ||
| - id: ruff-format | ||
|
|
There was a problem hiding this comment.
Yep ... i was left very confused why pre-commit was complaining and not making any changes until I realized there were two! 🙃
| def test_st_geogfromwkb(eng, geom, expected): | ||
| eng = eng.create_or_skip() | ||
| eng.assert_query_result( | ||
| f"SELECT ST_GeogFromWKB(ST_AsBinary({geom_or_null(geom)}))", expected |
There was a problem hiding this comment.
This would be a less circular test if it used shapely to convert to WKB. That would also let you check flavor="iso" and flavor="extended", which both engines should accept.
It's also worth checking what happens on invalid input (we error...I'm not sure what PostGIS does).
paleolimbot
left a comment
There was a problem hiding this comment.
Thank you! Just one nit to look into!
| eng.assert_query_result( | ||
| f"SELECT ST_Area(ST_Buffer({geom_or_null(geom)}, {val_or_null(dist)}))", | ||
| expected_area, | ||
| numeric_epsilon=1e-1, |
There was a problem hiding this comment.
This seems like a pretty high epsilon for things we think should be almost equal. Can this be lower?
There was a problem hiding this comment.
Oh that's right ... I forgot how numbers work for a sec. This is a higher value, not a lower one. I changed it to the same as the default value.
Uh oh!
There was an error while loading. Please reload this page.