@@ -65,20 +65,14 @@ def test_feature_flag_from_json_without_metadata(self):
6565
6666 def test_flag_reason_from_json (self ):
6767 # Test with complete data
68- resp = {
69- "code" : "user_in_segment" ,
70- "condition_index" : 1 ,
71- "description" : "User is in segment 'beta_users'"
72- }
68+ resp = {"code" : "user_in_segment" , "condition_index" : 1 , "description" : "User is in segment 'beta_users'" }
7369 reason = FlagReason .from_json (resp )
7470 self .assertEqual (reason .code , "user_in_segment" )
7571 self .assertEqual (reason .condition_index , 1 )
7672 self .assertEqual (reason .description , "User is in segment 'beta_users'" )
7773
7874 # Test with partial data
79- resp = {
80- "code" : "user_in_segment"
81- }
75+ resp = {"code" : "user_in_segment" }
8276 reason = FlagReason .from_json (resp )
8377 self .assertEqual (reason .code , "user_in_segment" )
8478 self .assertEqual (reason .condition_index , 0 ) # default value
@@ -89,22 +83,15 @@ def test_flag_reason_from_json(self):
8983
9084 def test_flag_metadata_from_json (self ):
9185 # Test with complete data
92- resp = {
93- "id" : 123 ,
94- "payload" : {"key" : "value" },
95- "version" : 1 ,
96- "description" : "Test flag"
97- }
86+ resp = {"id" : 123 , "payload" : {"key" : "value" }, "version" : 1 , "description" : "Test flag" }
9887 metadata = FlagMetadata .from_json (resp )
9988 self .assertEqual (metadata .id , 123 )
10089 self .assertEqual (metadata .payload , {"key" : "value" })
10190 self .assertEqual (metadata .version , 1 )
10291 self .assertEqual (metadata .description , "Test flag" )
10392
10493 # Test with partial data
105- resp = {
106- "id" : 123
107- }
94+ resp = {"id" : 123 }
10895 metadata = FlagMetadata .from_json (resp )
10996 self .assertEqual (metadata .id , 123 )
11097 self .assertIsNone (metadata .payload )
@@ -123,14 +110,9 @@ def test_feature_flag_from_json_complete(self):
123110 "reason" : {
124111 "code" : "user_in_segment" ,
125112 "condition_index" : 1 ,
126- "description" : "User is in segment 'beta_users'"
113+ "description" : "User is in segment 'beta_users'" ,
127114 },
128- "metadata" : {
129- "id" : 123 ,
130- "payload" : {"key" : "value" },
131- "version" : 1 ,
132- "description" : "Test flag"
133- }
115+ "metadata" : {"id" : 123 , "payload" : {"key" : "value" }, "version" : 1 , "description" : "Test flag" },
134116 }
135117 flag = FeatureFlag .from_json (resp )
136118 self .assertEqual (flag .key , "test-flag" )
@@ -144,10 +126,7 @@ def test_feature_flag_from_json_complete(self):
144126
145127 def test_feature_flag_from_json_minimal_data (self ):
146128 # Test with minimal data
147- resp = {
148- "key" : "test-flag" ,
149- "enabled" : False
150- }
129+ resp = {"key" : "test-flag" , "enabled" : False }
151130 flag = FeatureFlag .from_json (resp )
152131 self .assertEqual (flag .key , "test-flag" )
153132 self .assertFalse (flag .enabled )
@@ -158,13 +137,7 @@ def test_feature_flag_from_json_minimal_data(self):
158137
159138 def test_feature_flag_from_json_with_reason (self ):
160139 # Test with reason but no metadata
161- resp = {
162- "key" : "test-flag" ,
163- "enabled" : True ,
164- "reason" : {
165- "code" : "user_in_segment"
166- }
167- }
140+ resp = {"key" : "test-flag" , "enabled" : True , "reason" : {"code" : "user_in_segment" }}
168141 flag = FeatureFlag .from_json (resp )
169142 self .assertEqual (flag .key , "test-flag" )
170143 self .assertTrue (flag .enabled )
0 commit comments