Skip to content

Commit b91f003

Browse files
update: Fix formatting in DefaultCmabService and test cases
1 parent a48bd72 commit b91f003

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

optimizely/cmab/cmab_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def get_decision(self, project_config: ProjectConfig, user_context: OptimizelyUs
6161

6262
attributes_hash = self._hash_attributes(filtered_attributes)
6363

64-
if cached_value :
64+
if cached_value:
6565
if cached_value['attributes_hash'] == attributes_hash:
6666
return CmabDecision(variation_id=cached_value['variation_id'], cmab_uuid=cached_value['cmab_uuid'])
6767
elif OptimizelyDecideOption.INVALIDATE_USER_CMAB_CACHE not in options:

tests/test_cmab_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from optimizely.project_config import ProjectConfig
2121
from optimizely.entities import Attribute
2222

23+
2324
class TestDefaultCmabService(unittest.TestCase):
2425
def setUp(self):
2526
self.mock_cmab_cache = MagicMock(spec=LRUCache)
@@ -112,7 +113,7 @@ def test_new_decision_when_hash_changes(self):
112113
user_attrs = {"age": 25, "location": "USA"}
113114
expected_hash = self.cmab_service._hash_attributes(user_attrs)
114115
expected_key = self.cmab_service._get_cache_key("user123", "exp1")
115-
116+
116117
decision = self.cmab_service.get_decision(self.mock_project_config, self.mock_user_context, "exp1", [])
117118
self.mock_cmab_cache.remove.assert_called_once_with(expected_key)
118119
self.mock_cmab_cache.save.assert_called_once_with(

0 commit comments

Comments
 (0)