Skip to content

Commit

Permalink
Fix test_trends
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c committed Jun 21, 2024
1 parent fda2051 commit 6ec189a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions posthog/hogql_queries/insights/trends/test/test_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2834,14 +2834,14 @@ def test_trends_with_hogql_math(self):
team=self.team,
event="sign up",
distinct_id="blabla",
properties={"$session_id": s1},
properties={"$session_id": s1, "x": 1},
timestamp="2020-01-01 00:06:30",
)
self._create_event(
team=self.team,
event="sign up",
distinct_id="blabla",
properties={"$session_id": s5},
properties={"$session_id": s5, "x": 5},
timestamp="2020-01-02 00:06:45",
)

Expand All @@ -2855,7 +2855,7 @@ def test_trends_with_hogql_math(self):
{
"id": "sign up",
"math": "hogql",
"math_hogql": "avg(properties.$session_id) + 1000",
"math_hogql": "avg(properties.x) + 1000",
}
],
},
Expand Down
9 changes: 6 additions & 3 deletions posthog/queries/test/test_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
set_instance_setting,
)
from posthog.models.person.util import create_person_distinct_id
from posthog.models.utils import uuid7
from posthog.queries.trends.breakdown import BREAKDOWN_OTHER_STRING_LABEL
from posthog.queries.trends.trends import Trends
from posthog.test.base import (
Expand Down Expand Up @@ -2651,6 +2652,8 @@ def test_property_filtering(self):

@snapshot_clickhouse_queries
def test_trends_with_hogql_math(self):
s1 = str(uuid7("2020-01-01", 1))
s5 = str(uuid7("2020-01-01", 5))
_create_person(
team_id=self.team.pk,
distinct_ids=["blabla", "anonymous_id"],
Expand All @@ -2660,14 +2663,14 @@ def test_trends_with_hogql_math(self):
team=self.team,
event="sign up",
distinct_id="blabla",
properties={"$session_id": 1},
properties={"$session_id": s1, "x": 1},
timestamp="2020-01-01 00:06:30",
)
_create_event(
team=self.team,
event="sign up",
distinct_id="blabla",
properties={"$session_id": 5},
properties={"$session_id": s5, "x": 5},
timestamp="2020-01-02 00:06:45",
)

Expand All @@ -2681,7 +2684,7 @@ def test_trends_with_hogql_math(self):
{
"id": "sign up",
"math": "hogql",
"math_hogql": "avg(toInt(properties.$session_id)) + 1000",
"math_hogql": "avg(toInt(properties.x)) + 1000",
}
],
},
Expand Down

0 comments on commit 6ec189a

Please sign in to comment.