Skip to content

Add $toString, $toBool, $toObjectId tests, and convert coverage#688

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

Add $toString, $toBool, $toObjectId tests, and convert coverage#688
PatersonProjects wants to merge 14 commits into
documentdb:mainfrom
PatersonProjects:type_related_tests

Conversation

@PatersonProjects

@PatersonProjects PatersonProjects commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This PR adds the $toString, $toBool, and $toObjectId tests. It also adds the utilities needed to run the $convert versions of the tests in this PR and in PR #684. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a new type utility to allow each test to also run with $convert. It works a little differently than it originally did, so that the tests can keep using ExpressionTestCase, rather than needing their own classes, but should have the same end functionality.

PatersonProjects and others added 3 commits July 16, 2026 12:27
…tests

Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
@PatersonProjects PatersonProjects changed the title Add $toString, $toBool, $toObjectId tests Add $toString, $toBool, $toObjectId tests, and convert coverage Jul 16, 2026
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
Signed-off-by: PatersonProjects <keldonhoff@gmail.com>
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