Skip to content

Add $toString, $toBool, $toObjectId tests#688

Open
PatersonProjects wants to merge 9 commits into
documentdb:mainfrom
PatersonProjects:type_related_tests
Open

Add $toString, $toBool, $toObjectId tests#688
PatersonProjects wants to merge 9 commits into
documentdb:mainfrom
PatersonProjects:type_related_tests

Conversation

@PatersonProjects

Copy link
Copy Markdown
Contributor

This PR adds the $toString, $toBool, and $toObjectId tests. It was originally authored by @danielfrankcom

Ref: Issue #15, #331, #325, #330

Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
…-tests

Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
…-tests

Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
…-tests

Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
…-tests

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>
@PatersonProjects PatersonProjects marked this pull request as ready for review July 15, 2026 17:56
@PatersonProjects PatersonProjects requested a review from a team as a code owner July 15, 2026 17:56
@documentdb-triage-tool documentdb-triage-tool Bot added compatibility test Compatibility test related enhancement New feature or request labels Jul 15, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: compatibility test, enhancement
Project fields suggested: Component test-coverage · Priority P2 · Effort XL · Status Needs Review
Confidence: 0.85 (mixed)

Reasoning

component from path globs (test-coverage); effort from diff stats (3041+0 LOC, 25 files); LLM: Adds new compatibility test cases for $toString, $toBool, and $toObjectId operators, expanding test coverage across multiple related issues.

If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

@danielfrankcom danielfrankcom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this before, but all of the $toX operators also need to be parameterized against $convert: {input, to} since they are an alias, and the $convert coverage relies on them existing.

See this comment.

@pytest.mark.parametrize(
"test", pytest_params(TOSTRING_ARITY_TESTS + TOSTRING_INVALID_FIELD_PATH_TESTS)
)
def test_toString_arity(collection, test: ExpressionTestCase):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think every test in these files was originally parameterized over $convert too. These $toX operators are essentially an alias for $convert: {input, to}.

I missed this in the context of #684 but we should probably fix it there too as it's a significant coverage gap. The $convert tests rely on these split coverage.

expected=None,
),
ExpressionTestCase(
"composite_array_path",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need an equivalent case for the other 2 operators, this seems to be the only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility test Compatibility test related enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants