Skip to content

Commit e1d32de

Browse files
committed
docs: fix typos and remove unused type
1 parent 96a12b6 commit e1d32de

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

decoy/types.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@
99

1010
ReturnT = TypeVar("ReturnT")
1111
"""The return type of a given call."""
12-
13-
Call = Any
14-
"""A type alias representing a unittest.mock._Call."""

docs/why.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The `Mock` class (and friends) provided by the Python standard library are great
88
- Not geared towards mimicking the type annotations of your actual interfaces
99
- Geared towards call-then-assert-called test patterns
1010

11-
At its core, Decoy uses test fakes that stripped down, slightly more opinionated versions of `Mock` that are designed to work with type annotations.
11+
At its core, Decoy uses test fakes that are stripped down, slightly more opinionated versions of `Mock` that are designed to work with type annotations.
1212

1313
[unittest.mock]: https://docs.python.org/3/library/unittest.mock.html
1414

@@ -25,7 +25,7 @@ Decoy is meant to be an "opinionated" library. The opinions that Decoy (and its
2525
- Are you using a partial mock to ease testing with a complex (or third-party) dependency, and if so, is that test better as an integration test?
2626

2727
[partial mocks]: https://github.com/testdouble/contributing-tests/wiki/Partial-Mock
28-
[single-responsibilty principle]: https://en.wikipedia.org/wiki/Single-responsibility_principle
28+
[single-responsibility principle]: https://en.wikipedia.org/wiki/Single-responsibility_principle
2929

3030
### Without configuration, test doubles should no-op
3131

@@ -41,6 +41,11 @@ Decoy is meant to be an "opinionated" library. The opinions that Decoy (and its
4141

4242
[arrange act assert]: https://github.com/testdouble/contributing-tests/wiki/Arrange-Act-Assert
4343

44+
### unittest.mock is a good library
45+
46+
- `unittest.mock` is a well designed, flexible, and powerful mocking library
47+
- You may have tests that don't work nicely with Decoy, or legacy code that would be too hard to refactor, and that's OK! Just use [unittest.mock][], instead
48+
4449
### Stubs should not return unconditionally
4550

4651
- Setting `unittest.mock.Mock::return_value` is unconditional, in that all subsequent calls to that mock will receive that return value, even if they are called incorrectly
@@ -148,7 +153,7 @@ Both of these options have roughly the same upside and downsides:
148153
- Option 1 separates the input checking from output value, and they appear in reverse chronological order (you define the dependency output before you define the input)
149154
- Option 2 forces you to create a whole new function and assign it to the `side_effect` value
150155
- Downside: `MagicMock` is effectively `Any` typed
151-
- `return_value` and `assert_called_with` are not typed according to the dependency's type definition
156+
- `return_value` and `assert_called_with` are not typed according to the dependency's type annotations
152157
- A manual `side_effect`, if typed, needs to be manually typed, which may not match the actual dependency type definition
153158

154159
Option 1 has another downside, specifically:

0 commit comments

Comments
 (0)