Skip to content

Add string operator $substr/$substrBytes/$substrCP tests#80

Open
eerxuan wants to merge 2 commits intodocumentdb:mainfrom
eerxuan:upstream-substr-tests
Open

Add string operator $substr/$substrBytes/$substrCP tests#80
eerxuan wants to merge 2 commits intodocumentdb:mainfrom
eerxuan:upstream-substr-tests

Conversation

@eerxuan
Copy link
Copy Markdown
Collaborator

@eerxuan eerxuan commented Apr 10, 2026

Add compatibility tests for the $substr, $substrBytes, and $substrCP operators.

Ref: #10

Tests cover:

  • Core substring behavior
  • Encoding (UTF-8 byte vs code point handling)
  • Numeric and string coercion
  • Type errors and invalid arguments
  • Null/missing handling
  • Size limits
  • Expression arguments and document field usage

785 tests total.

danielfrankcom and others added 2 commits April 9, 2026 16:56
Signed-off-by: Daniel Frankcom <frankcom@amazon.com>
- Add __init__.py for package resolution
- Add SUBSTR_*, SUBSTRCP_*, FIELD_PATH_NULL_BYTE_ERROR, OUT_OF_RANGE_CONVERSION_ERROR, INVALID_DOLLAR_FIELD_PATH, BSON_TO_STRING_CONVERSION_ERROR, STRING_SIZE_LIMIT_ERROR to error_codes.py
- Add STRING_SIZE_LIMIT_BYTES, DECIMAL128_MIN_POSITIVE, DECIMAL128_MAX_NEGATIVE to test_constants.py
- Fix pytest_params import (parametrize module)
- Use relative imports for operator common utils
- Pin CI MongoDB to 8.2.4
- Run isort/black formatting

Signed-off-by: Yunxuan Shi <yunxuan@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants