Commit 5811563
committed
Mock the
Mocking the init method is messy because then the code in the real
`__init__` method doesn’t get run, so properties like `content` don’t
get set.
We can still test the same thing (which arguments the `Field` is
instantiated with) by mocking the whole class. Then any downstream code
which is looking at the field will be dealing with a mock, which returns
something for properties like `content` which don’t exist.Field class, not just its init method1 parent f238dd9 commit 5811563
1 file changed
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
1315 | | - | |
1316 | | - | |
| 1315 | + | |
1317 | 1316 | | |
1318 | 1317 | | |
1319 | 1318 | | |
| |||
1392 | 1391 | | |
1393 | 1392 | | |
1394 | 1393 | | |
1395 | | - | |
1396 | | - | |
| 1394 | + | |
1397 | 1395 | | |
1398 | | - | |
1399 | | - | |
| 1396 | + | |
1400 | 1397 | | |
1401 | 1398 | | |
1402 | 1399 | | |
| |||
1405 | 1402 | | |
1406 | 1403 | | |
1407 | 1404 | | |
1408 | | - | |
| 1405 | + | |
1409 | 1406 | | |
1410 | 1407 | | |
1411 | 1408 | | |
| |||
0 commit comments