Skip to content

fix: test_row_validation_result_filter_operation error - #1437

Merged
linglp merged 1 commit into
developfrom
fix-test_row_validation_result_filter_operators
Jul 28, 2026
Merged

fix: test_row_validation_result_filter_operation error #1437
linglp merged 1 commit into
developfrom
fix-test_row_validation_result_filter_operators

Conversation

@linglp

@linglp linglp commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem:

test_row_validation_result_filter_operation error had an error but I didn't catch it because the integration tests took too long to complete:

___________________ TestGridValidateRowsAsync.test_row_validation_result_filter_operators[not_like] ____________________

self = <test_grid_async.TestGridValidateRowsAsync object at 0x10e0f9b50>
connected_grid = Grid(record_set_id='syn76472280', initial_query=None, owner_principal_id=3443707, authorization_mode=None, session_id=...tion.schema-0.0.1', source_entity_id='syn76472280', record_set_version_number=None, validation_summary_statistics=None)
operator = <ValidationOperator.NOT_LIKE: 'NOT_LIKE'>, validation_result_value = '%', expected_ids = set()

    @pytest.mark.parametrize(
        "operator,validation_result_value,expected_ids",
        [
            # LIKE '%' matches any non-empty message, so only the invalid
            # rows (which have a message) match.
            pytest.param(ValidationOperator.LIKE, "%", {3, 4}, id="like"),
            # NOT_LIKE '%' never matches: invalid rows have a message that
            # matches '%' (and so are excluded), while valid rows have no
            # message at all to compare against.
            pytest.param(ValidationOperator.NOT_LIKE, "%", set(), id="not_like"),
        ],
    )
    async def test_row_validation_result_filter_operators(
        self,
        connected_grid: Grid,
        operator: ValidationOperator,
        validation_result_value: str,
        expected_ids: set,
    ) -> None:
        # WHEN: Filtering rows by their validation message
        result = await connected_grid.validate_rows_async(
            query_request=QueryRequest(
                query=GridQuery(
                    column_selection=[SelectAll()],
                    filters=[
                        RowValidationResultFilter(
                            operator=operator,
                            validation_result_value=validation_result_value,
                        )
                    ],
                    include_validation_messages=True,
                )
            ),
            synapse_client=self.syn,
        )
    
        # THEN: Only the rows matching that operator/value are returned
>       assert {row.data["id"] for row in result.rows} == expected_ids
E       assert {1, 2, 5} == set()
E         
E         Extra items in the left set:
E         1
E         2
E         5
E         Use -v to get more diff

/Users/lpeng/code/synapsePythonClient/tests/integration/synapseclient/models/async/test_grid_async.py:741: AssertionErro

Solution:

fix the test

Testing:

tests/integration/synapseclient/models/async/test_grid_async.py::TestGridValidateRowsAsync::test_select_all_returns_full_data_and_validation_results
  /Users/lpeng/code/synapsePythonClient/tests/integration/synapseclient/models/async/test_grid_async.py:512: DeprecationWarning: Call to deprecated method service. (To be removed in 5.0.0. This is a beta feature with no replacement.) -- Deprecated since version 4.11.0.
    js = syn.service("json_schema")

tests/integration/synapseclient/models/async/test_grid_async.py::TestGridValidateRowsAsync::test_select_all_returns_full_data_and_validation_results
  /Users/lpeng/code/synapsePythonClient/synapseclient/client.py:1705: DeprecationWarning: Call to deprecated class JsonSchemaService. (To be removed in 5.0.0. Use the OOP JSON Schema models instead, synapseclient.models.SchemaOrganization and synapseclient.models.JSONSchema.) -- Deprecated since version 4.11.0.
    service = service_cls(self)

tests/integration/synapseclient/models/async/test_grid_async.py::TestGridValidateRowsAsync::test_select_all_returns_full_data_and_validation_results
  /Users/lpeng/code/synapsePythonClient/synapseclient/services/json_schema.py:563: DeprecationWarning: Call to deprecated class JsonSchemaOrganization. (To be removed in 5.0.0. Use synapseclient.models.SchemaOrganization instead.) -- Deprecated since version 4.11.0.
    instance = JsonSchemaOrganization(*args, **kwargs)

tests/integration/synapseclient/models/async/test_grid_async.py::TestGridValidateRowsAsync::test_select_all_returns_full_data_and_validation_results
  /Users/lpeng/code/synapsePythonClient/synapseclient/services/json_schema.py:82: DeprecationWarning: Call to deprecated class JsonSchemaVersion. (To be removed in 5.0.0. Use synapseclient.models.JSONSchema instead.) -- Deprecated since version 4.11.0.
    version = cls(organization, response["schemaName"], semver)

tests/integration/synapseclient/models/async/test_grid_async.py::TestGridValidateRowsAsync::test_select_all_returns_full_data_and_validation_results
  /Users/lpeng/code/synapsePythonClient/synapseclient/core/utils.py:747: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    datetime_instance = datetime.datetime.utcfromtimestamp(secs).replace(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================================================== 23 passed, 5 warnings in 39.26s =======================================================================

@linglp
linglp requested a review from a team as a code owner July 28, 2026 15:22
Copilot AI review requested due to automatic review settings July 28, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates an integration test for the Grid row-validation filtering behavior to align expected results with the backend semantics (notably how NOT_LIKE behaves when rows have no validation message).

Changes:

  • Adjusts the RowValidationResultFilter operator/value test matrix and expected row IDs.
  • Simplifies assertions in test_row_validation_result_filter_operators after updating expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/synapseclient/models/async/test_grid_async.py
Comment thread tests/integration/synapseclient/models/async/test_grid_async.py

@andrewelamb andrewelamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@linglp
linglp merged commit ac942af into develop Jul 28, 2026
27 of 33 checks passed
@linglp
linglp deleted the fix-test_row_validation_result_filter_operators branch July 28, 2026 19:25
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.

4 participants