@@ -802,7 +802,8 @@ def test_get_configuration_with_envelope_and_raw(mocker, config):
802
802
803
803
assert "log_level" in config
804
804
assert "log_level" not in features_config
805
-
805
+
806
+
806
807
##
807
808
## Inequality test cases
808
809
##
@@ -828,9 +829,12 @@ def test_flags_not_equal_no_match(mocker, config):
828
829
}
829
830
}
830
831
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
831
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" }, default = False )
832
+ toggle = feature_flags .evaluate (
833
+ name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" }, default = False
834
+ )
832
835
assert toggle == expected_value
833
836
837
+
834
838
def test_flags_not_equal_match (mocker , config ):
835
839
expected_value = True
836
840
mocked_app_config_schema = {
@@ -876,9 +880,14 @@ def test_flags_less_than_no_match_1(mocker, config):
876
880
}
877
881
}
878
882
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
879
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" }, default = False )
883
+ toggle = feature_flags .evaluate (
884
+ name = "my_feature" ,
885
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" },
886
+ default = False ,
887
+ )
880
888
assert toggle == expected_value
881
889
890
+
882
891
def test_flags_less_than_no_match_2 (mocker , config ):
883
892
expected_value = False
884
893
mocked_app_config_schema = {
@@ -899,9 +908,14 @@ def test_flags_less_than_no_match_2(mocker, config):
899
908
}
900
909
}
901
910
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
902
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" }, default = False )
911
+ toggle = feature_flags .evaluate (
912
+ name = "my_feature" ,
913
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" },
914
+ default = False ,
915
+ )
903
916
assert toggle == expected_value
904
917
918
+
905
919
def test_flags_less_than_match (mocker , config ):
906
920
expected_value = True
907
921
mocked_app_config_schema = {
@@ -922,10 +936,15 @@ def test_flags_less_than_match(mocker, config):
922
936
}
923
937
}
924
938
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
925
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" }, default = False )
939
+ toggle = feature_flags .evaluate (
940
+ name = "my_feature" ,
941
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" },
942
+ default = False ,
943
+ )
926
944
assert toggle == expected_value
927
945
928
- # Test less than or equal to
946
+
947
+ # Test less than or equal to
929
948
def test_flags_less_than_or_equal_no_match (mocker , config ):
930
949
expected_value = False
931
950
mocked_app_config_schema = {
@@ -946,9 +965,14 @@ def test_flags_less_than_or_equal_no_match(mocker, config):
946
965
}
947
966
}
948
967
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
949
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" }, default = False )
968
+ toggle = feature_flags .evaluate (
969
+ name = "my_feature" ,
970
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" },
971
+ default = False ,
972
+ )
950
973
assert toggle == expected_value
951
974
975
+
952
976
def test_flags_less_than_or_equal_match_1 (mocker , config ):
953
977
expected_value = True
954
978
mocked_app_config_schema = {
@@ -969,7 +993,11 @@ def test_flags_less_than_or_equal_match_1(mocker, config):
969
993
}
970
994
}
971
995
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
972
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" }, default = False )
996
+ toggle = feature_flags .evaluate (
997
+ name = "my_feature" ,
998
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" },
999
+ default = False ,
1000
+ )
973
1001
assert toggle == expected_value
974
1002
975
1003
@@ -993,9 +1021,14 @@ def test_flags_less_than_or_equal_match_2(mocker, config):
993
1021
}
994
1022
}
995
1023
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
996
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" }, default = False )
1024
+ toggle = feature_flags .evaluate (
1025
+ name = "my_feature" ,
1026
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" },
1027
+ default = False ,
1028
+ )
997
1029
assert toggle == expected_value
998
1030
1031
+
999
1032
# Test greater than
1000
1033
def test_flags_greater_than_no_match_1 (mocker , config ):
1001
1034
expected_value = False
@@ -1017,9 +1050,14 @@ def test_flags_greater_than_no_match_1(mocker, config):
1017
1050
}
1018
1051
}
1019
1052
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1020
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" }, default = False )
1053
+ toggle = feature_flags .evaluate (
1054
+ name = "my_feature" ,
1055
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" },
1056
+ default = False ,
1057
+ )
1021
1058
assert toggle == expected_value
1022
1059
1060
+
1023
1061
def test_flags_greater_than_no_match_2 (mocker , config ):
1024
1062
expected_value = False
1025
1063
mocked_app_config_schema = {
@@ -1040,9 +1078,14 @@ def test_flags_greater_than_no_match_2(mocker, config):
1040
1078
}
1041
1079
}
1042
1080
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1043
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" }, default = False )
1081
+ toggle = feature_flags .evaluate (
1082
+ name = "my_feature" ,
1083
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" },
1084
+ default = False ,
1085
+ )
1044
1086
assert toggle == expected_value
1045
1087
1088
+
1046
1089
def test_flags_greater_than_match (mocker , config ):
1047
1090
expected_value = True
1048
1091
mocked_app_config_schema = {
@@ -1063,10 +1106,15 @@ def test_flags_greater_than_match(mocker, config):
1063
1106
}
1064
1107
}
1065
1108
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1066
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" }, default = False )
1109
+ toggle = feature_flags .evaluate (
1110
+ name = "my_feature" ,
1111
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" },
1112
+ default = False ,
1113
+ )
1067
1114
assert toggle == expected_value
1068
1115
1069
- # Test greater than or equal to
1116
+
1117
+ # Test greater than or equal to
1070
1118
def test_flags_greater_than_or_equal_no_match (mocker , config ):
1071
1119
expected_value = False
1072
1120
mocked_app_config_schema = {
@@ -1087,9 +1135,14 @@ def test_flags_greater_than_or_equal_no_match(mocker, config):
1087
1135
}
1088
1136
}
1089
1137
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1090
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" }, default = False )
1138
+ toggle = feature_flags .evaluate (
1139
+ name = "my_feature" ,
1140
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.04.01" },
1141
+ default = False ,
1142
+ )
1091
1143
assert toggle == expected_value
1092
1144
1145
+
1093
1146
def test_flags_greater_than_or_equal_match_1 (mocker , config ):
1094
1147
expected_value = True
1095
1148
mocked_app_config_schema = {
@@ -1110,7 +1163,11 @@ def test_flags_greater_than_or_equal_match_1(mocker, config):
1110
1163
}
1111
1164
}
1112
1165
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1113
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" }, default = False )
1166
+ toggle = feature_flags .evaluate (
1167
+ name = "my_feature" ,
1168
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.12.25" },
1169
+ default = False ,
1170
+ )
1114
1171
assert toggle == expected_value
1115
1172
1116
1173
@@ -1134,6 +1191,9 @@ def test_flags_greater_than_or_equal_match_2(mocker, config):
1134
1191
}
1135
1192
}
1136
1193
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
1137
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" }, default = False )
1194
+ toggle = feature_flags .evaluate (
1195
+ name = "my_feature" ,
1196
+ context = {"tenant_id" : "345345435" , "username" : "a" , "current_date" : "2021.10.31" },
1197
+ default = False ,
1198
+ )
1138
1199
assert toggle == expected_value
1139
-
0 commit comments