Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanatic committed Aug 21, 2024
1 parent 27539ab commit e541923
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 32 deletions.
3 changes: 2 additions & 1 deletion posthog/feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

log = logging.getLogger("posthog")

NONE_VALUES_ALLOWED_OPERATORS = ['is_not']
NONE_VALUES_ALLOWED_OPERATORS = ["is_not"]


class InconclusiveMatchError(Exception):
pass
Expand Down
46 changes: 15 additions & 31 deletions posthog/test/test_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,67 +967,51 @@ def test_feature_flags_local_evaluation_None_values(self, patch_get, patch_decid
client.feature_flags = [
{
id: 1,
"name": 'Beta Feature',
"key": 'beta-feature',
"name": "Beta Feature",
"key": "beta-feature",
"is_simple_flag": True,
"active": True,
"filters": {
"groups": [
{
"variant": None,
"properties": [
{
"key": "latestBuildVersion",
"type": "person",
"value": ".+",
"operator": "regex"
},
{
"key": "latestBuildVersionMajor",
"type": "person",
"value": "23",
"operator": "gt"
},
{
"key": "latestBuildVersionMinor",
"type": "person",
"value": "31",
"operator": "gt"
},
{
"key": "latestBuildVersionPatch",
"type": "person",
"value": "0",
"operator": "gt"
}
{"key": "latestBuildVersion", "type": "person", "value": ".+", "operator": "regex"},
{"key": "latestBuildVersionMajor", "type": "person", "value": "23", "operator": "gt"},
{"key": "latestBuildVersionMinor", "type": "person", "value": "31", "operator": "gt"},
{"key": "latestBuildVersionPatch", "type": "person", "value": "0", "operator": "gt"},
],
"rollout_percentage": 100
"rollout_percentage": 100,
}
],
},
},
]

feature_flag_match = client.get_feature_flag(
"beta-feature", "some-distinct-id", person_properties={
"beta-feature",
"some-distinct-id",
person_properties={
"latestBuildVersion": None,
"latestBuildVersionMajor": None,
"latestBuildVersionMinor": None,
"latestBuildVersionPatch": None,
}
},
)

self.assertEqual(feature_flag_match, False)
self.assertEqual(patch_decide.call_count, 0)
self.assertEqual(patch_get.call_count, 0)

feature_flag_match = client.get_feature_flag(
"beta-feature", "some-distinct-id", person_properties={
"beta-feature",
"some-distinct-id",
person_properties={
"latestBuildVersion": "24.32..1",
"latestBuildVersionMajor": "24",
"latestBuildVersionMinor": "32",
"latestBuildVersionPatch": "1",
}
},
)

@mock.patch("posthog.client.decide")
Expand Down

0 comments on commit e541923

Please sign in to comment.