Added geospatial tests for $near#218
Conversation
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (test-coverage, test-framework); effort from diff stats (1691+0 LOC, 11 files); LLM: Adds new geospatial $near test cases under the compatibility tests directory, expanding test coverage for an important query operator. If a label is wrong, remove it manually and ping |
Signed-off-by: Victor [C] Tsang <vitsangp@amazon.com>
e4ccd92 to
ff0efac
Compare
Signed-off-by: Victor [C] Tsang <vitsangp@amazon.com>
a6e9f98 to
d4cc5fd
Compare
Signed-off-by: Victor [C] Tsang <vitsangp@amazon.com>
|
|
||
|
|
||
| @pytest.fixture | ||
| def geo_2dsphere(collection): |
There was a problem hiding this comment.
I missed this, remember to keep each test case self-contained: has setup command and expected. So
pytestmark = pytest.mark.usefixtures("geo_2dsphere")
file level fixture breaks the pattern.
Also, you have fixture and inline create_index, which means this fixture is not flexible enough.
Please remove the fixture. We should have consistent format for index setup and collection setup.
We can create a similar index helpers as the CustomCollection etc. This can keep the self-contained test case pattern, and it is flexible enough so we can have TestCase specific index setup.
CommandTestCase(
"collation_null_uses_default",
target_collection=CustomCollection(options={"collation": {"locale": "en", "strength": 2}}),
docs=[{"_id": 1, "s": "abc"}, {"_id": 2, "s": "ABC"}, {"_id": 3, "s": "def"}],
command=lambda ctx: {
"count": ctx.collection,
"query": {"s": "abc"},
"collation": None,
},
expected={"n": 2, "ok": 1.0},
msg="count with collation=null should use collection default collation",
),
This PR contains:
Ref: