john-bodley commented on code in PR #28653: URL: https://github.com/apache/superset/pull/28653#discussion_r1613590625
########## tests/unit_tests/db_engine_specs/test_presto.py: ########## @@ -116,46 +115,44 @@ def test_get_schema_from_engine_params() -> None: @pytest.mark.parametrize( ["column_type", "column_value", "expected_value"], [ - (types.DATE(), "2023-05-01", "DATE '2023-05-01'"), - (types.TIMESTAMP(), "2023-05-01", "TIMESTAMP '2023-05-01'"), - (types.VARCHAR(), "2023-05-01", "'2023-05-01'"), - (types.INT(), 1234, "1234"), + ("DATE", "2023-05-01", "DATE '2023-05-01'"), + ("TIMESTAMP", "2023-05-01", "TIMESTAMP '2023-05-01'"), + ("VARCHAR", "2023-05-01", "'2023-05-01'"), + ("INT", 1234, "1234"), ], ) def test_where_latest_partition( - mock_latest_partition, column_type, column_value: Any, expected_value: str + mock_latest_partition, + column_type: str, + column_value: Any, + expected_value: str, ) -> None: - """ - Test the ``where_latest_partition`` method - """ - from superset.db_engine_specs.presto import PrestoEngineSpec as spec + from superset.db_engine_specs.presto import PrestoEngineSpec mock_latest_partition.return_value = (["partition_key"], [column_value]) - query = sql.select(text("* FROM table")) - columns: list[ResultSetColumnType] = [ - { - "column_name": "partition_key", - "name": "partition_key", - "type": column_type, - "is_dttm": False, - } - ] - - expected = f"""SELECT * FROM table \nWHERE "partition_key" = {expected_value}""" - result = spec.where_latest_partition( - mock.MagicMock(), - Table("table"), - query, - columns, - ) - assert result is not None - actual = result.compile( - dialect=PrestoDialect(), compile_kwargs={"literal_binds": True} + assert ( Review Comment: Same logic as before just condensed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org