Skip to content

Commit 20e45ba

Browse files
committed
refact: rename ArrayMatching -> ListMatching
1 parent cbb19f9 commit 20e45ba

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

decoy/matchers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def DictMatching(values: Mapping[str, Any]) -> Any:
229229
return _DictMatching(values)
230230

231231

232-
class _ArrayMatching:
232+
class _ListMatching:
233233
_values: List[Any]
234234

235235
def __init__(self, values: List[Any]) -> None:
@@ -246,22 +246,22 @@ def __eq__(self, target: object) -> bool:
246246

247247
def __repr__(self) -> str:
248248
"""Return a string representation of the matcher."""
249-
return f"<ArrayMatching {self._values!r}>"
249+
return f"<ListMatching {self._values!r}>"
250250

251251

252-
def ArrayMatching(values: List[Any]) -> Any:
253-
"""Match any array with the passed in values.
252+
def ListMatching(values: List[Any]) -> Any:
253+
"""Match any list with the passed in values.
254254
255255
Arguments:
256256
values: Values to check.
257257
258258
!!! example
259259
```python
260260
value = [1, 2, 3]
261-
assert value == matchers.ArrayMatching([1, 2])
261+
assert value == matchers.ListMatching([1, 2])
262262
```
263263
"""
264-
return _ArrayMatching(values)
264+
return _ListMatching(values)
265265

266266

267267
class _StringMatching:

tests/test_matchers.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,26 @@ def test_dict_matching_matcher() -> None:
9292
assert [] != matchers.DictMatching({"hello": "world"})
9393

9494

95-
def test_array_matching_matcher() -> None:
96-
"""It should have an "anything with these attributes" matcher."""
97-
assert [1, 2, 3] == matchers.ArrayMatching([1])
98-
assert [1, 2, 3] == matchers.ArrayMatching([1, 2])
99-
assert [1, 2, 3] == matchers.ArrayMatching([1, 2, 3])
100-
assert [1, 2, 3] != matchers.ArrayMatching([1, 2, 3, 4])
101-
assert [1] != matchers.ArrayMatching([1, 2])
102-
103-
assert [{"hello": "world"}, {"yoo": "man"}] == matchers.ArrayMatching(
95+
def test_list_matching_matcher() -> None:
96+
assert [1, 2, 3] == matchers.ListMatching([1])
97+
assert [1, 2, 3] == matchers.ListMatching([1, 2])
98+
assert [1, 2, 3] == matchers.ListMatching([1, 2, 3])
99+
assert [1, 2, 3] != matchers.ListMatching([1, 2, 3, 4])
100+
assert [1] != matchers.ListMatching([1, 2])
101+
102+
assert [{"hello": "world"}, {"yoo": "man"}] == matchers.ListMatching(
104103
[{"hello": "world"}]
105104
)
106-
assert [{"hello": "world"}, {"yoo": "man"}] == matchers.ArrayMatching(
105+
assert [{"hello": "world"}, {"yoo": "man"}] == matchers.ListMatching(
107106
[{"yoo": "man"}]
108107
)
109-
assert [{"hello": "world"}, {"yoo": "man"}] != matchers.ArrayMatching(
108+
assert [{"hello": "world"}, {"yoo": "man"}] != matchers.ListMatching(
110109
[{"yoo": "mann"}]
111110
)
112111

113-
assert 1 != matchers.ArrayMatching([1])
112+
assert 1 != matchers.ListMatching([1])
114113

115-
assert str(matchers.ArrayMatching([1])) == "<ArrayMatching [1]>"
114+
assert str(matchers.ListMatching([1])) == "<ListMatching [1]>"
116115

117116

118117
def test_string_matching_matcher() -> None:

0 commit comments

Comments
 (0)