Add $centerSphere tests#217
Conversation
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (test-coverage); effort from diff stats (1452+0 LOC, 7 files); LLM: Adds new compatibility tests for the $centerSphere geospatial specifier, expanding test coverage for an existing tracked feature request. If a label is wrong, remove it manually and ping |
vic-tsang
left a comment
There was a problem hiding this comment.
consider adding these test cases:
- LineString with one vertex outside sphere (validates "fully within" semantics)
- Embedded document with {"x": 0, "y": 0} keys as legacy coordinates
- 3-element array [0, 0, 0] as location field (uses first two elements)
- Single-element array [5] as location field (should not match)
- Decimal128('NaN') as coordinates (should error)
- Decimal128('Infinity') as radius (should succeed, same as float Infinity)
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
…ects/functional-tests into center_sphere_tests Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
| error_code=BAD_VALUE_ERROR, | ||
| msg="Should reject BinData coordinates", | ||
| ), | ||
| QueryTestCase( |
There was a problem hiding this comment.
Remove Code tests, they are deprecated.
There was a problem hiding this comment.
I believe according to the docs the base Code (Javascript) which this test is using still is in use , it is JS with scope that is deprecated
| ), | ||
| QueryTestCase( | ||
| id="pole_proximity_north", | ||
| filter={"loc": {"$geoWithin": {"$centerSphere": [[0, 90], 200 / 6371]}}}, |
There was a problem hiding this comment.
magic number, extract to a module-level constant like RADIUS_200_KM_IN_RADIANS = 200 / 6371 with a comment.
There was a problem hiding this comment.
Added constant, replaced magic numbers in tests
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
| from documentdb_tests.framework.test_constants import DECIMAL128_INFINITY, FLOAT_INFINITY | ||
|
|
||
| # Earth's mean radius in km; used to convert km to radians (km / R) | ||
| EARTH_RADIUS_KM = 6371 |
There was a problem hiding this comment.
Other files still have raw number. Can you put this to geospatial/utils/ and update all places.
There was a problem hiding this comment.
Removed magic number across all files, moved constant to geospatial/utils/constants.py
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
This PR adds the compatibility tests for the $centerSphere geospatial specifier:
Ref: Issue #32