Skip to content

Commit

Permalink
mypy and test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aspicer committed Sep 5, 2024
1 parent 3e3df74 commit 1c1560c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion posthog/hogql_queries/insights/funnels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _get_breakdown_expr(self) -> ast.Expr:
elif breakdownType == "data_warehouse_person_property" and isinstance(breakdown, str):
return ast.Field(chain=["person", *breakdown.split(".")])
else:
raise ExposedHogQLError(detail=f"Unsupported breakdown type: {breakdownType}")
raise ExposedHogQLError(f"Unsupported breakdown type: {breakdownType}")

def _format_results(
self, results
Expand Down
3 changes: 2 additions & 1 deletion posthog/hogql_queries/insights/funnels/test/test_funnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from posthog.api.instance_settings import get_instance_setting
from posthog.clickhouse.client.execute import sync_execute
from posthog.constants import INSIGHT_FUNNELS, FunnelOrderType, FunnelVizType
from posthog.hogql.errors import ExposedHogQLError
from posthog.hogql.modifiers import create_default_modifiers_for_team
from posthog.hogql.query import execute_hogql_query
from posthog.hogql_queries.actors_query_runner import ActorsQueryRunner
Expand Down Expand Up @@ -1942,7 +1943,7 @@ def test_funnel_exclusions_invalid_params(self):
],
}
query = cast(FunnelsQuery, filter_to_query(filters))
self.assertRaises(ValidationError, lambda: FunnelsQueryRunner(query=query, team=self.team).calculate())
self.assertRaises(ExposedHogQLError, lambda: FunnelsQueryRunner(query=query, team=self.team).calculate())

def test_funnel_exclusion_no_end_event(self):
filters = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import unittest

from freezegun import freeze_time
from rest_framework.exceptions import ValidationError

from posthog.constants import INSIGHT_FUNNELS
from posthog.hogql.errors import ExposedHogQLError
from posthog.hogql_queries.insights.funnels.funnel_correlation_query_runner import (
EventContingencyTable,
EventStats,
Expand Down Expand Up @@ -1189,14 +1189,14 @@ def test_correlation_with_properties_raises_validation_error(self):
)
flush_persons_and_events()

with self.assertRaises(ValidationError):
with self.assertRaises(ExposedHogQLError):
self._get_events_for_filters(
filters,
funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,
# funnelCorrelationNames=["$browser"] -- missing
)

with self.assertRaises(ValidationError):
with self.assertRaises(ExposedHogQLError):
self._get_events_for_filters(
filters,
funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rest_framework.exceptions import ValidationError

from posthog.constants import INSIGHT_FUNNELS, FunnelOrderType
from posthog.hogql.errors import ExposedHogQLError
from posthog.hogql_queries.insights.funnels.funnels_query_runner import FunnelsQueryRunner
from posthog.hogql_queries.legacy_compatibility.filter_to_query import filter_to_query

Expand Down Expand Up @@ -1147,7 +1148,7 @@ def test_funnel_exclusions_invalid_params(self):
}

query = cast(FunnelsQuery, filter_to_query(filters))
self.assertRaises(ValidationError, lambda: FunnelsQueryRunner(query=query, team=self.team).calculate())
self.assertRaises(ExposedHogQLError, lambda: FunnelsQueryRunner(query=query, team=self.team).calculate())

def test_funnel_exclusions_full_window(self):
filters = {
Expand Down

0 comments on commit 1c1560c

Please sign in to comment.