Skip to content

Commit d271880

Browse files
committed
ran the formatter
1 parent feb9560 commit d271880

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

posthog/test/test_feature_flags.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,13 +2337,15 @@ def test_capture_is_called(self, patch_decide, patch_capture):
23372337
disable_geoip=None,
23382338
)
23392339

2340-
23412340
@mock.patch.object(Client, "capture")
23422341
@mock.patch("posthog.client.decide")
23432342
def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch_capture):
2344-
patch_decide.return_value = {"featureFlags": {"decide-flag": "decide-value"}, "featureFlagPayloads": {"person-flag": 300}}
2343+
patch_decide.return_value = {
2344+
"featureFlags": {"decide-flag": "decide-value"},
2345+
"featureFlagPayloads": {"person-flag": 300},
2346+
}
23452347
client = Client(api_key=FAKE_TEST_API_KEY, personal_api_key=FAKE_TEST_API_KEY)
2346-
2348+
23472349
client.feature_flags = [
23482350
{
23492351
"id": 1,
@@ -2361,14 +2363,12 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
23612363
},
23622364
}
23632365
]
2364-
2366+
23652367
# Call get_feature_flag_payload with match_value=None to trigger get_feature_flag
23662368
client.get_feature_flag_payload(
2367-
key="complex-flag",
2368-
distinct_id="some-distinct-id",
2369-
person_properties={"region": "USA", "name": "Aloha"}
2369+
key="complex-flag", distinct_id="some-distinct-id", person_properties={"region": "USA", "name": "Aloha"}
23702370
)
2371-
2371+
23722372
# Assert that capture was called once, with the correct parameters
23732373
self.assertEqual(patch_capture.call_count, 1)
23742374
patch_capture.assert_called_with(
@@ -2383,28 +2383,24 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
23832383
groups={},
23842384
disable_geoip=None,
23852385
)
2386-
2386+
23872387
# Reset mocks for further tests
23882388
patch_capture.reset_mock()
23892389
patch_decide.reset_mock()
2390-
2390+
23912391
# Call get_feature_flag_payload again for the same user; capture should not be called again because we've already reported an event for this distinct_id + flag
23922392
client.get_feature_flag_payload(
2393-
key="complex-flag",
2394-
distinct_id="some-distinct-id",
2395-
person_properties={"region": "USA", "name": "Aloha"}
2393+
key="complex-flag", distinct_id="some-distinct-id", person_properties={"region": "USA", "name": "Aloha"}
23962394
)
2397-
2395+
23982396
self.assertEqual(patch_capture.call_count, 0)
23992397
patch_capture.reset_mock()
2400-
2398+
24012399
# Call get_feature_flag_payload for a different user; capture should be called
24022400
client.get_feature_flag_payload(
2403-
key="complex-flag",
2404-
distinct_id="some-distinct-id2",
2405-
person_properties={"region": "USA", "name": "Aloha"}
2401+
key="complex-flag", distinct_id="some-distinct-id2", person_properties={"region": "USA", "name": "Aloha"}
24062402
)
2407-
2403+
24082404
self.assertEqual(patch_capture.call_count, 1)
24092405
patch_capture.assert_called_with(
24102406
"some-distinct-id2",
@@ -2418,9 +2414,9 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
24182414
groups={},
24192415
disable_geoip=None,
24202416
)
2421-
2417+
24222418
patch_capture.reset_mock()
2423-
2419+
24242420
@mock.patch.object(Client, "capture")
24252421
@mock.patch("posthog.client.decide")
24262422
def test_disable_geoip_get_flag_capture_call(self, patch_decide, patch_capture):

0 commit comments

Comments
 (0)