-
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
Simplify test accounts #6221
Simplify test accounts #6221
Conversation
d6577bf
to
21951cf
Compare
21951cf
to
e507b54
Compare
1c59c90
to
eee2132
Compare
eee2132
to
a899225
Compare
5119589
to
dbfc99e
Compare
dbfc99e
to
1ebd13d
Compare
1ebd13d
to
859a5b5
Compare
Codecov Report
@@ Coverage Diff @@
## master #6221 +/- ##
=========================================
Coverage ? 91.76%
=========================================
Files ? 392
Lines ? 29561
Branches ? 2500
=========================================
Hits ? 27126
Misses ? 1907
Partials ? 528 Continue to review full report at Codecov.
|
6fe0db3
to
f0dd66e
Compare
f0dd66e
to
ca1232b
Compare
ca1232b
to
d941d6c
Compare
92bf70b
to
0a495c3
Compare
) | ||
result = ClickhouseTrends().run(filter, self.team,) | ||
self.assertEqual(result[0]["count"], 1) | ||
result = ClickhouseTrends().run(filter.with_data({"filter_test_accounts": "false"}), self.team,) | ||
filter2 = Filter( |
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.
optional nit: This test is clearer if you run filter2 first, and then with_data({'filter_test_accounts': 'true'})
@@ -106,3 +108,7 @@ def __init__( | |||
|
|||
self._data = data | |||
self.kwargs = kwargs | |||
|
|||
if "team" in kwargs and not self.is_simplified: |
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.
Why do you need to do this here when you're doing it in the BaseFilter? O.o
Ah, is it because this class overrides self._data
? Hmmmm.
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.
Because BaseFilter init is not called here :)
@@ -0,0 +1,28 @@ | |||
from typing import TYPE_CHECKING, TypeVar | |||
|
|||
if TYPE_CHECKING: # Avoid circular import |
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.
when you already have the type in a quoted string, why do you need to do this?
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.
So mypy actually checks those quoted strings so you need to import them for typechecking to occur 😅
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.
Some minor comments, but otherwise looks good to me! Great work - really simplifies things around filter test accounts.
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.
super helpful refactor. filter_test_accounts
was weird to work with
0a495c3
to
182837d
Compare
This PR introduces the concept of "simplifying" filters. See #5877 for more detail
This is the first part of refactoring for #5854 - I'm planning on introducing "simplification" for cohort filters as well, but want to avoid excessive bloat.
Going forward, all controllers should pass team to filters on creation - we'll eventually make this mandatory as well.
How did you test this code?
Manual testing + existing code coverage