This repository was archived by the owner on Nov 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ def is_expected_type(
16
16
if expected_variation_type == cls .STRING :
17
17
return isinstance (assigned_variation .typedValue , str )
18
18
elif expected_variation_type == cls .NUMERIC :
19
- return isinstance (assigned_variation .typedValue , Number )
19
+ return isinstance (assigned_variation .typedValue , Number ) and not isinstance (
20
+ assigned_variation .typedValue , bool
21
+ )
20
22
elif expected_variation_type == cls .BOOLEAN :
21
23
return isinstance (assigned_variation .typedValue , bool )
22
24
elif expected_variation_type == cls .JSON :
Original file line number Diff line number Diff line change @@ -277,3 +277,14 @@ def get_assignments(test_case):
277
277
)
278
278
for subject in test_case .get ("subjectsWithAttributes" , [])
279
279
]
280
+
281
+
282
+ @pytest .mark .parametrize ("test_case" , test_data )
283
+ def test_get_numeric_assignment_on_bool_feature_flag_should_return_none (test_case ):
284
+ if test_case ["valueType" ] == "boolean" :
285
+ assignments = get_assignments (test_case = test_case )
286
+ assert assignments == test_case ["expectedAssignments" ]
287
+ # Change to get_numeric_assignment and try again
288
+ test_case ["valueType" ] = "numeric"
289
+ assignments = get_assignments (test_case = test_case )
290
+ assert assignments == [None ] * len (test_case ["expectedAssignments" ])
You can’t perform that action at this time.
0 commit comments