diff --git a/decoy/matchers.py b/decoy/matchers.py index fa2270c..bff9c10 100644 --- a/decoy/matchers.py +++ b/decoy/matchers.py @@ -199,7 +199,7 @@ def __eq__(self, target: object) -> bool: for key, value in self._values.items(): if is_match: try: - is_match = key in target and target[key] == value # type: ignore[index,operator] # noqa: E501 + is_match = key in target and target[key] == value # type: ignore[index,operator] except TypeError: is_match = False diff --git a/decoy/verifier.py b/decoy/verifier.py index 40a9fa5..2560db4 100644 --- a/decoy/verifier.py +++ b/decoy/verifier.py @@ -33,10 +33,7 @@ def verify( for i in range(len(calls)): calls_subset = calls[i : i + len(rehearsals)] - matches = [ - match_event(c, r) - for c, r in zip(calls_subset, rehearsals) # noqa: B905 - ] + matches = [match_event(c, r) for c, r in zip(calls_subset, rehearsals)] if all(matches) and len(calls_subset) == len(rehearsals): match_count = match_count + 1 diff --git a/decoy/warnings.py b/decoy/warnings.py index 4697ad3..a9102bf 100644 --- a/decoy/warnings.py +++ b/decoy/warnings.py @@ -79,7 +79,7 @@ def __init__(self, rehearsal: VerifyRehearsal) -> None: "The same rehearsal was used in both a `when` and a `verify`.", "This is redundant and probably a misuse of the mock.", f"\t{stringify_call(rehearsal)}", - "See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning", # noqa: E501 + "See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning", ] ) super().__init__(message) diff --git a/poetry.lock b/poetry.lock index 289fd62..b070231 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1049,28 +1049,28 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "ruff" -version = "0.0.276" +version = "0.0.284" description = "An extremely fast Python linter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.0.276-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:c150912b8ebde843c10b33db90705d4fee48db6f05441e5d143be9f4c2f35df5"}, - {file = "ruff-0.0.276-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:5e9cd7238d34f24d7ccfadcce4dc6807b8c5a390f547dd7236d06488d9d6f40f"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc7dc557cc3fa2a03a88e99425ceee91429cc7432e5a41087850c1629294faed"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:13e5983836ae383c04de213954da731f14ea884aaf74467abc47e1d79d8cf1b7"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4ac65df96be3e2f4b10bc97bbb624152281611b06ef1068d5bb064b7ad35d800"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:d070a64de4affd17e006d6986ef25601dbbc6b373844ece5396c33900f8b8563"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2edcd6948a21fa7fb4594094da37a1aa1d205b7abaa718bd27d48ba1d7977348"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:57c49b525d8ca3838d8b614f42e342077bed95aedd9fe6e6ec419f39320c214e"}, - {file = "ruff-0.0.276-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5980960a748ada3ddfe4ea7ff3a01b9113c456a14cb1a39b4c30783012d4cba6"}, - {file = "ruff-0.0.276-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:12be4f007114cf5ed1242e522762651539521ec32ae0210cc4b8dfe434a872f0"}, - {file = "ruff-0.0.276-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:6ed8fc729b3e7b9f20a4e2aa6f24c798b06912f8a94cb3e8fd590eba055780df"}, - {file = "ruff-0.0.276-py3-none-musllinux_1_2_i686.whl", hash = "sha256:735d724031212c2ab63fafdea49d4581ae866a1180d06c29b0b5481228ca6bb9"}, - {file = "ruff-0.0.276-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:100ad9055d50977c2b4ab3de0db62d6e525bcd4aafbb660a842733bdbf650be9"}, - {file = "ruff-0.0.276-py3-none-win32.whl", hash = "sha256:1b34a3673b2e5d97df8f7f04090c0b74e9ae6d3d172921d0e0781192954afddf"}, - {file = "ruff-0.0.276-py3-none-win_amd64.whl", hash = "sha256:02deadc0f6abead6cc2d38ddd7100a52aba27a0d90315facaa44b8b4acdba162"}, - {file = "ruff-0.0.276-py3-none-win_arm64.whl", hash = "sha256:a6bd5b53ac689a43c7afc45bd574a7b3efe0ceb192e26e95a055c770ef2045b9"}, - {file = "ruff-0.0.276.tar.gz", hash = "sha256:d456c86eb6ce9225507f24fcc7bf72fa031bb7cc750023310e62889bf4ad4b6a"}, + {file = "ruff-0.0.284-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:8b949084941232e2c27f8d12c78c5a6a010927d712ecff17231ee1a8371c205b"}, + {file = "ruff-0.0.284-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:a3930d66b35e4dc96197422381dff2a4e965e9278b5533e71ae8474ef202fab0"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d1f7096038961d8bc3b956ee69d73826843eb5b39a5fa4ee717ed473ed69c95"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bcaf85907fc905d838f46490ee15f04031927bbea44c478394b0bfdeadc27362"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b3660b85a9d84162a055f1add334623ae2d8022a84dcd605d61c30a57b436c32"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:0a3218458b140ea794da72b20ea09cbe13c4c1cdb7ac35e797370354628f4c05"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b2fe880cff13fffd735387efbcad54ba0ff1272bceea07f86852a33ca71276f4"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d1d098ea74d0ce31478765d1f8b4fbdbba2efc532397b5c5e8e5ea0c13d7e5ae"}, + {file = "ruff-0.0.284-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4c79ae3308e308b94635cd57a369d1e6f146d85019da2fbc63f55da183ee29b"}, + {file = "ruff-0.0.284-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f86b2b1e7033c00de45cc176cf26778650fb8804073a0495aca2f674797becbb"}, + {file = "ruff-0.0.284-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e37e086f4d623c05cd45a6fe5006e77a2b37d57773aad96b7802a6b8ecf9c910"}, + {file = "ruff-0.0.284-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d29dfbe314e1131aa53df213fdfea7ee874dd96ea0dd1471093d93b59498384d"}, + {file = "ruff-0.0.284-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:88295fd649d0aa1f1271441df75bf06266a199497afd239fd392abcfd75acd7e"}, + {file = "ruff-0.0.284-py3-none-win32.whl", hash = "sha256:735cd62fccc577032a367c31f6a9de7c1eb4c01fa9a2e60775067f44f3fc3091"}, + {file = "ruff-0.0.284-py3-none-win_amd64.whl", hash = "sha256:f67ed868d79fbcc61ad0fa034fe6eed2e8d438d32abce9c04b7c4c1464b2cf8e"}, + {file = "ruff-0.0.284-py3-none-win_arm64.whl", hash = "sha256:1292cfc764eeec3cde35b3a31eae3f661d86418b5e220f5d5dba1c27a6eccbb6"}, + {file = "ruff-0.0.284.tar.gz", hash = "sha256:ebd3cc55cd499d326aac17a331deaea29bea206e01c08862f9b5c6e93d77a491"}, ] [[package]] @@ -1213,4 +1213,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "ddf84c8977f154268ee60571d868c58b66ff2c4a911f9b37ad3c0e91dc0ddb03" +content-hash = "aabdfdb9ed41662e134512cb28b7c83fc59cdc33c4375a36191b3130b4b52a7f" diff --git a/pyproject.toml b/pyproject.toml index 5efe504..8c86d6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,10 +36,18 @@ pytest = "7.4.0" pytest-asyncio = "0.21.1" pytest-mypy-plugins = "2.0.0" pytest-xdist = "3.3.1" -ruff = "0.0.276" +ruff = "0.0.284" [tool.poe.tasks] -all = [ "check", "lint", "format-check", "test-once", "coverage", "docs-build", "build" ] +all = [ + "check", + "lint", + "format-check", + "test-once", + "coverage", + "docs-build", + "build", +] check = "mypy" lint = "ruff check ." format = "black ." @@ -51,8 +59,8 @@ coverage-xml = "coverage xml" docs = "mkdocs serve" docs-build = "mkdocs build" build = "poetry build" -check-ci = [ "check", "lint", "format-check" ] -test-ci = [ "test-once", "coverage-xml" ] +check-ci = ["check", "lint", "format-check"] +test-ci = ["test-once", "coverage-xml"] build-ci = ["docs-build", "build"] [tool.poetry.plugins."pytest11"] @@ -72,22 +80,10 @@ show_error_codes = true exclude_lines = ["@overload", "if TYPE_CHECKING:"] [tool.ruff] +target-version = "py37" extend-exclude = [".cache"] -ignore = [ - "ANN101", - "ANN102", - "ANN401", - "D107", -] -select = [ - "ANN", - "B", - "D", - "E", - "F", - "RUF", - "W", -] +select = ["ANN", "B", "D", "E", "F", "RUF", "W"] +ignore = ["ANN101", "ANN102", "ANN401", "D107", "E501"] [tool.ruff.pydocstyle] convention = "google" diff --git a/tests/test_matchers.py b/tests/test_matchers.py index 87b7547..0a89cfe 100644 --- a/tests/test_matchers.py +++ b/tests/test_matchers.py @@ -20,7 +20,7 @@ def goodbye(self) -> str: def test_any_matcher() -> None: """It should have an "anything except None" matcher.""" assert 1 == matchers.Anything() - assert False == matchers.Anything() # noqa[E712] + assert False == matchers.Anything() # noqa: E712 assert {} == matchers.Anything() assert [] == matchers.Anything() assert ("hello", "world") == matchers.Anything() @@ -30,7 +30,7 @@ def test_any_matcher() -> None: def test_is_a_matcher() -> None: """It should have an "anything that is this type" matcher.""" assert 1 == matchers.IsA(int) - assert False == matchers.IsA(bool) # noqa[E712] + assert False == matchers.IsA(bool) # noqa: E712 assert {} == matchers.IsA(dict) assert [] == matchers.IsA(list) assert ("hello", "world") == matchers.IsA(tuple) @@ -42,7 +42,7 @@ def test_is_a_matcher() -> None: def test_is_a_matcher_checks_instance(decoy: Decoy) -> None: - """The IsA matchers should respect ininstance logic.""" + """The IsA matchers should respect isinstance logic.""" target = decoy.mock(cls=SomeClass) assert target == matchers.IsA(SomeClass) @@ -50,13 +50,13 @@ def test_is_a_matcher_checks_instance(decoy: Decoy) -> None: def test_is_not_matcher() -> None: """It should have an "anything that isn't this" matcher.""" assert 1 == matchers.IsNot(2) - assert False == matchers.IsNot(True) # noqa[E712] + assert False == matchers.IsNot(True) # noqa: E712 assert {} == matchers.IsNot({"hello": "world"}) assert [] == matchers.IsNot(["hello", "world"]) assert ("hello", "world") == matchers.IsNot(("hey", "there")) assert 1 != matchers.IsNot(1) - assert False != matchers.IsNot(False) # noqa[E712] + assert False != matchers.IsNot(False) # noqa: E712 assert {} != matchers.IsNot({}) assert [] != matchers.IsNot([]) assert ("hello", "world") != matchers.IsNot(("hello", "world")) @@ -71,7 +71,7 @@ def test_has_attribute_matcher() -> None: assert {"hello": "world"} != matchers.HasAttributes({"hello": "world"}) assert _HelloTuple("world") != matchers.HasAttributes({"goodbye": "so long"}) assert 1 != matchers.HasAttributes({"hello": "world"}) - assert False != matchers.HasAttributes({"hello": "world"}) # noqa[E712] + assert False != matchers.HasAttributes({"hello": "world"}) # noqa: E712 assert [] != matchers.HasAttributes({"hello": "world"}) @@ -87,7 +87,7 @@ def test_dict_matching_matcher() -> None: assert {"hello": "world"} != matchers.DictMatching({"goodbye": "so long"}) assert 1 != matchers.DictMatching({"hello": "world"}) - assert False != matchers.DictMatching({"hello": "world"}) # noqa[E712] + assert False != matchers.DictMatching({"hello": "world"}) # noqa: E712 assert [] != matchers.DictMatching({"hello": "world"}) @@ -101,7 +101,7 @@ def test_error_matching_matcher() -> None: """It should have an "any error that matches" matcher.""" assert RuntimeError("ah!") == matchers.ErrorMatching(RuntimeError) assert RuntimeError("ah!") == matchers.ErrorMatching(RuntimeError, "ah") - assert RuntimeError("ah!") != matchers.ErrorMatching(TypeError, "ah") # type: ignore[comparison-overlap] # noqa: E501 + assert RuntimeError("ah!") != matchers.ErrorMatching(TypeError, "ah") # type: ignore[comparison-overlap] assert RuntimeError("ah!") != matchers.ErrorMatching(RuntimeError, "ah$") diff --git a/tests/test_warnings.py b/tests/test_warnings.py index 6823079..a384045 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -112,7 +112,7 @@ class WarningSpec(NamedTuple): "The same rehearsal was used in both a `when` and a `verify`.", "This is redundant and probably a misuse of the mock.", "\tspy(1)", - "See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning", # noqa: E501 + "See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning", ] ), ),