Add $avg accumulator tests#190
Conversation
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (test-coverage, test-framework); effort from diff stats (2914+0 LOC, 14 files); LLM: Adds new integration test coverage for the $avg accumulator operator under the compatibility tests path, a meaningful but non-blocking functional improvement. If a label is wrong, remove it manually and ping |
3a3a39a to
df7d6f5
Compare
|
I will address applicable comments for #214 in this PR as well. |
|
Removed |
8a875ac to
79910b3
Compare
eerxuan
left a comment
There was a problem hiding this comment.
- Lost coverage: $group arity tests. The 3 arity tests for $avg in $group ({"$avg": ["$v", "$v"]} →
expect GROUP_ACCUMULATOR_ARRAY_ARGUMENT_ERROR) were dropped along with the $bucket/$bucketAuto versions.
The $group ones are genuinely accumulator-contract tests — they're verifying that $avg rejects
multi-element-array form regardless of stage. Suggest re-adding just the $group cases:
AccumulatorTestCase("arity_multi_element_group",
pipeline=[{"$group": {"_id": None, "result": {"$avg": ["$v", "$v"]}}}],
error_code=GROUP_ACCUMULATOR_ARRAY_ARGUMENT_ERROR,
msg="$avg should reject multi-element array syntax in $group"),
AccumulatorTestCase("arity_empty_array_group",
pipeline=[{"$group": {"_id": None, "result": {"$avg": []}}}],
error_code=GROUP_ACCUMULATOR_ARRAY_ARGUMENT_ERROR,
msg="$avg should reject empty array syntax in $group"),
AccumulatorTestCase("arity_single_element_group",
pipeline=[{"$group": {"_id": None, "result": {"$avg": ["$v"]}}}],
error_code=GROUP_ACCUMULATOR_ARRAY_ARGUMENT_ERROR,
msg="$avg should reject single-element array syntax in $group"),
used tests from local generate and Daniel F Signed-off-by: Alina (Xi) Li <[email protected]> copied AccumulatorTestCase from sum branch Signed-off-by: Alina (Xi) Li <[email protected]> convert tests to use Signed-off-by: Alina (Xi) Li <[email protected]> Add init.py Signed-off-by: Alina (Xi) Li <[email protected]> split into smaller test files Signed-off-by: Alina (Xi) Li <[email protected]> remove duplicate tests Signed-off-by: Alina (Xi) Li <[email protected]> rename to make tests clearer Signed-off-by: Alina (Xi) Li <[email protected]> Avg integration tests Signed-off-by: Alina (Xi) Li <[email protected]> style changes Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
Signed-off-by: Alina (Xi) Li <[email protected]>
|
@eerxuan Thanks for reviewing, I think the |
This change adds tests for the $avg accumulator operator.
Add accumulator operator tests for $avg. Tests database $avg behavior, output collection, syntax, and expected errors.
Integration tests are in
documentdb_tests/compatibility/tests/core/operator/accumulators/test_accumulators_avg_integration.py