Skip to content

Commit 6c2cc11

Browse files
committed
formatting
1 parent dbd0699 commit 6c2cc11

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

posthog/test/test_client.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,20 +385,19 @@ def test_basic_capture_with_locally_evaluated_feature_flags(self, patch_decide):
385385
assert "$feature/false-flag" not in msg["properties"]
386386
assert "$active_feature_flags" not in msg["properties"]
387387

388-
389388
@mock.patch("posthog.client.get")
390389
def test_load_feature_flags_quota_limited(self, patch_get):
391390
mock_response = {
392391
"type": "quota_limited",
393392
"detail": "You have exceeded your feature flag request quota",
394-
"code": "payment_required"
393+
"code": "payment_required",
395394
}
396395
patch_get.side_effect = APIError(402, mock_response["detail"])
397-
396+
398397
client = Client(FAKE_TEST_API_KEY, personal_api_key="test")
399398
with self.assertLogs("posthog", level="WARNING") as logs:
400399
client._load_feature_flags()
401-
400+
402401
self.assertEqual(client.feature_flags, [])
403402
self.assertEqual(client.feature_flags_by_key, {})
404403
self.assertEqual(client.group_type_mapping, {})

posthog/test/test_request.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,30 @@ def test_should_timeout(self):
4848
def test_quota_limited_response(self):
4949
mock_response = requests.Response()
5050
mock_response.status_code = 200
51-
mock_response._content = json.dumps({
52-
"quotaLimited": ["feature_flags"],
53-
"featureFlags": {},
54-
"featureFlagPayloads": {},
55-
"errorsWhileComputingFlags": False
56-
}).encode('utf-8')
57-
58-
with mock.patch('posthog.request._session.post', return_value=mock_response):
51+
mock_response._content = json.dumps(
52+
{
53+
"quotaLimited": ["feature_flags"],
54+
"featureFlags": {},
55+
"featureFlagPayloads": {},
56+
"errorsWhileComputingFlags": False,
57+
}
58+
).encode("utf-8")
59+
60+
with mock.patch("posthog.request._session.post", return_value=mock_response):
5961
with self.assertRaises(QuotaLimitError) as cm:
6062
decide("fake_key", "fake_host")
61-
63+
6264
self.assertEqual(cm.exception.status, 200)
6365
self.assertEqual(cm.exception.message, "Feature flags quota limited")
6466

6567
def test_normal_decide_response(self):
6668
mock_response = requests.Response()
6769
mock_response.status_code = 200
68-
mock_response._content = json.dumps({
69-
"featureFlags": {"flag1": True},
70-
"featureFlagPayloads": {},
71-
"errorsWhileComputingFlags": False
72-
}).encode('utf-8')
70+
mock_response._content = json.dumps(
71+
{"featureFlags": {"flag1": True}, "featureFlagPayloads": {}, "errorsWhileComputingFlags": False}
72+
).encode("utf-8")
7373

74-
with mock.patch('posthog.request._session.post', return_value=mock_response):
74+
with mock.patch("posthog.request._session.post", return_value=mock_response):
7575
response = decide("fake_key", "fake_host")
7676
self.assertEqual(response["featureFlags"], {"flag1": True})
7777

0 commit comments

Comments
 (0)