Skip to content

Commit

Permalink
fix: the len() method of Variables should return the schema length.
Browse files Browse the repository at this point in the history
  • Loading branch information
cecily_carver committed Jan 29, 2025
1 parent 3ef51d3 commit 5a5160a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mysql_mimic/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __iter__(self) -> Iterator[str]:
return self._values.__iter__()

def __len__(self) -> int:
return len(self._values)
return len(self.schema)

def get_schema(self, name: str) -> VariableSchema:
schema = self.schema.get(name)
Expand Down
1 change: 1 addition & 0 deletions tests/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_parse_timezone() -> None:

def test_variable_mapping() -> None:
test_vars = TestVars()
assert test_vars

assert test_vars.get_variable("foo") == "bar"
assert test_vars["foo"] == "bar"
Expand Down

0 comments on commit 5a5160a

Please sign in to comment.