-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: trends query runner tests #18479
Changes from all commits
d79002a
4b33ada
cafd665
b75a63f
bf0131b
79167f6
805f5e3
0710024
9e94f88
0840df2
f23f5f8
f06857d
3752dba
922299b
75fe022
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,17 +30,17 @@ def test_with_simple_equality_clause(self): | |
""" | ||
SELECT event | ||
FROM events | ||
WHERE event = '$pageview' | ||
WHERE team_id = 1 | ||
""" | ||
) | ||
|
||
compare_operators = self._compare_operators(query, "events") | ||
|
||
assert len(compare_operators) == 1 | ||
assert compare_operators[0] == ast.CompareOperation( | ||
left=ast.Field(chain=["event"]), | ||
left=ast.Field(chain=["team_id"]), | ||
op=ast.CompareOperationOp.Eq, | ||
right=ast.Constant(value="$pageview"), | ||
right=ast.Constant(value=1), | ||
) | ||
|
||
def test_with_timestamps(self): | ||
|
@@ -66,35 +66,35 @@ def test_with_alias_table(self): | |
""" | ||
SELECT e.event | ||
FROM events e | ||
WHERE e.event = '$pageview' | ||
WHERE e.team_id = 1 | ||
""" | ||
) | ||
|
||
compare_operators = self._compare_operators(query, "e") | ||
|
||
assert len(compare_operators) == 1 | ||
assert compare_operators[0] == ast.CompareOperation( | ||
left=ast.Field(chain=["event"]), | ||
left=ast.Field(chain=["team_id"]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come you're comparing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we not intentionally exclude |
||
op=ast.CompareOperationOp.Eq, | ||
right=ast.Constant(value="$pageview"), | ||
right=ast.Constant(value=1), | ||
) | ||
|
||
def test_with_multiple_clauses(self): | ||
query = self._select( | ||
""" | ||
SELECT event | ||
FROM events | ||
WHERE event = '$pageview' AND timestamp > '2023-01-01' | ||
WHERE team_id = 1 AND timestamp > '2023-01-01' | ||
""" | ||
) | ||
|
||
compare_operators = self._compare_operators(query, "events") | ||
|
||
assert len(compare_operators) == 2 | ||
assert compare_operators[0] == ast.CompareOperation( | ||
left=ast.Field(chain=["event"]), | ||
left=ast.Field(chain=["team_id"]), | ||
op=ast.CompareOperationOp.Eq, | ||
right=ast.Constant(value="$pageview"), | ||
right=ast.Constant(value=1), | ||
) | ||
assert compare_operators[1] == ast.CompareOperation( | ||
left=ast.Field(chain=["timestamp"]), | ||
|
@@ -109,25 +109,25 @@ def test_with_join(self): | |
FROM events e | ||
LEFT JOIN persons p | ||
ON e.person_id = p.id | ||
WHERE e.event = '$pageview' and p.is_identified = 0 | ||
WHERE e.team_id = 1 and p.is_identified = 0 | ||
""" | ||
) | ||
|
||
compare_operators = self._compare_operators(query, "e") | ||
|
||
assert len(compare_operators) == 1 | ||
assert compare_operators[0] == ast.CompareOperation( | ||
left=ast.Field(chain=["event"]), | ||
left=ast.Field(chain=["team_id"]), | ||
op=ast.CompareOperationOp.Eq, | ||
right=ast.Constant(value="$pageview"), | ||
right=ast.Constant(value=1), | ||
) | ||
|
||
def test_with_ignoring_ors(self): | ||
query = self._select( | ||
""" | ||
SELECT event | ||
FROM events | ||
WHERE event = '$pageleave' OR event = '$pageview' | ||
WHERE team_id = 1 OR team_id = 2 | ||
""" | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copout 🤣