Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat001 committed Dec 5, 2023
1 parent 85d671d commit f7b507b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion optimizely/optimizely_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def stringify_conditions(self, conditions: str | list[Any], audiences_map: dict[
operand = conditions[i].upper()
else:
# Check if element is a list or not
if type(conditions[i]) == list:
if isinstance(conditions[i], list):
# Check if at the end or not to determine where to add the operand
# Recursive call to call stringify on embedded list
if i + 1 < length:
Expand Down
72 changes: 36 additions & 36 deletions tests/test_optimizely_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,45 +1479,45 @@ def test__duplicate_experiment_keys(self):

# update the test datafile with an additional feature flag with the same experiment rule key
new_experiment = {
'key': 'test_experiment', # added duplicate "test_experiment"
'status': 'Running',
'layerId': '8',
"audienceConditions": [
"or",
"11160"
],
'audienceIds': ['11160'],
'id': '111137',
'forcedVariations': {},
'trafficAllocation': [
{'entityId': '222242', 'endOfRange': 8000},
{'entityId': '', 'endOfRange': 10000}
],
'variations': [
{
'id': '222242',
'key': 'control',
'variables': [],
}
],
'key': 'test_experiment', # added duplicate "test_experiment"
'status': 'Running',
'layerId': '8',
"audienceConditions": [
"or",
"11160"
],
'audienceIds': ['11160'],
'id': '111137',
'forcedVariations': {},
'trafficAllocation': [
{'entityId': '222242', 'endOfRange': 8000},
{'entityId': '', 'endOfRange': 10000}
],
'variations': [
{
'id': '222242',
'key': 'control',
'variables': [],
}
],
}

new_feature = {
'id': '91117',
'key': 'new_feature',
'experimentIds': ['111137'],
'rolloutId': '',
'variables': [
{'id': '127', 'key': 'is_working', 'defaultValue': 'true', 'type': 'boolean'},
{'id': '128', 'key': 'environment', 'defaultValue': 'devel', 'type': 'string'},
{'id': '129', 'key': 'cost', 'defaultValue': '10.99', 'type': 'double'},
{'id': '130', 'key': 'count', 'defaultValue': '999', 'type': 'integer'},
{'id': '131', 'key': 'variable_without_usage', 'defaultValue': '45', 'type': 'integer'},
{'id': '132', 'key': 'object', 'defaultValue': '{"test": 12}', 'type': 'string',
'subType': 'json'},
{'id': '133', 'key': 'true_object', 'defaultValue': '{"true_test": 23.54}', 'type': 'json'},
],
}
'id': '91117',
'key': 'new_feature',
'experimentIds': ['111137'],
'rolloutId': '',
'variables': [
{'id': '127', 'key': 'is_working', 'defaultValue': 'true', 'type': 'boolean'},
{'id': '128', 'key': 'environment', 'defaultValue': 'devel', 'type': 'string'},
{'id': '129', 'key': 'cost', 'defaultValue': '10.99', 'type': 'double'},
{'id': '130', 'key': 'count', 'defaultValue': '999', 'type': 'integer'},
{'id': '131', 'key': 'variable_without_usage', 'defaultValue': '45', 'type': 'integer'},
{'id': '132', 'key': 'object', 'defaultValue': '{"test": 12}', 'type': 'string',
'subType': 'json'},
{'id': '133', 'key': 'true_object', 'defaultValue': '{"true_test": 23.54}', 'type': 'json'},
],
}

# add new experiment rule with the same key and a new feature with the same rule key
self.config_dict_with_features['experiments'].append(new_experiment)
Expand Down

0 comments on commit f7b507b

Please sign in to comment.