Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 8298647

Browse files
committed
Remove __len__ override for variable store
Overriding __len__ broke many tests, there might be implicit checks like `if variable_store:` that were breaking with the override, outside of test state functionality. Changing to a more explicit length check
1 parent b307afe commit 8298647

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

localstack-core/localstack/services/stepfunctions/asl/eval/test_state/environment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def __init__(
5151
variable_store=variable_store,
5252
)
5353
self.inspection_data = InspectionData()
54-
if variable_store:
55-
self.inspection_data["variables"] = to_json_str(variable_store.to_key_value_dict())
54+
variables = variable_store.to_dict()
55+
if variables:
56+
self.inspection_data["variables"] = to_json_str(variables)
5657
self.mock = mock
5758

5859
def is_test_state_mocked_mode(self) -> bool:

localstack-core/localstack/services/stepfunctions/asl/eval/variable_store.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_assigned_variables(self) -> dict[str, str]:
8989
assigned_variables[traced_declaration_identifier] = traced_declaration_value_json_str
9090
return assigned_variables
9191

92-
def to_key_value_dict(self) -> dict[str, str]:
92+
def to_dict(self) -> dict[str, str]:
9393
assigned_variables: dict[str, str] = {}
9494
for traced_declaration_identifier in self._declaration_tracing:
9595
assigned_variables[traced_declaration_identifier] = self.get(
@@ -131,6 +131,3 @@ def get_variable_declarations(self) -> VariableDeclarations:
131131
[self._outer_variable_declaration_cache, inner_variable_declarations_cache]
132132
)
133133
return self._variable_declarations_cache
134-
135-
def __len__(self):
136-
return len(self._declaration_tracing)

0 commit comments

Comments
 (0)