Skip to content

Commit

Permalink
fix: Fix some tests and mypy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Jan 28, 2025
1 parent bca3b12 commit 2be1459
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion posthog/api/test/batch_exports/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def test_create_batch_export_with_custom_schema(client: HttpClient):
}

assert batch_export.schema == expected_schema
assert args["batch_export_model"] == {"name": "events", "schema": expected_schema}
assert args["batch_export_model"] == {"filters": None, "name": "events", "schema": expected_schema}


@pytest.mark.parametrize(
Expand Down
1 change: 1 addition & 0 deletions posthog/api/test/batch_exports/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def test_can_patch_hogql_query(client: HttpClient):
assert args["interval"] == "hour"
assert args["batch_export_model"] == {
"name": "events",
"filters": None,
"schema": {
"fields": [
{
Expand Down
7 changes: 5 additions & 2 deletions posthog/temporal/batch_exports/spmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def compose_filters_clause(
)
context.database = create_hogql_database(team.id, context.modifiers)

exprs = [property_to_expr(EventPropertyFilter(**filter), team=team) for filter in filters] # type: ignore
exprs = [property_to_expr(EventPropertyFilter(**filter), team=team) for filter in filters]
and_expr = ast.And(exprs=exprs)
select_query = ast.SelectQuery(
select=[parse_expr("properties as properties")],
Expand All @@ -873,7 +873,10 @@ def compose_filters_clause(
)

printed = print_prepared_ast(
prepared_and_expr, context=context, dialect="clickhouse", stack=[prepared_select_query]
prepared_and_expr, # type: ignore
context=context,
dialect="clickhouse",
stack=[prepared_select_query],
)

return printed, context.values
4 changes: 2 additions & 2 deletions posthog/temporal/tests/batch_exports/test_spmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def test_use_events_recent(test_data: dict[str, typing.Any]):
),
],
)
async def test_compose_filters_clause(
def test_compose_filters_clause(
filters: list[dict[str, typing.Any]], expected_clause: str, expected_values: dict[str, str], ateam
):
result_clause, result_values = await compose_filters_clause(filters, team_id=ateam.id)
result_clause, result_values = compose_filters_clause(filters, team_id=ateam.id)
assert result_clause == expected_clause
assert result_values == expected_values

0 comments on commit 2be1459

Please sign in to comment.