Skip to content

Commit e1b0ae7

Browse files
committed
add autospec to mocker example
1 parent 6e5e067 commit e1b0ae7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/pages/principles/testing.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ namespace into an imported dependency's namespace, like so:
360360
```python
361361
def test_func(mocker):
362362
mock_sum = mocker.patch(
363-
"project.lib.np.sum"
363+
"project.lib.np.sum",
364+
autospec=True,
364365
) # you'll need to patch the alias'd namespace
365366
...
366367
```
@@ -376,7 +377,7 @@ file-under-test:
376377

377378
```python
378379
def test_func(mocker):
379-
np_sum = mocker.patch("project.lib.np_sum")
380+
np_sum = mocker.patch("project.lib.np_sum", autospec=True)
380381
...
381382
```
382383

0 commit comments

Comments
 (0)