Commit db5e86a
authored
Get mock coverage back to 100% (GH-18228)
* use the `: pass` and `: yield` patterns for code that isn't expected to ever be executed.
* The _Call items passed to _AnyComparer are only ever of length two, so assert instead of if/else
* fix typo
* Fix bug, where stop-without-start patching dict blows up with `TypeError: 'NoneType' object is not iterable`, highlighted by lack of coverage of an except branch.
* The fix for bpo-37972 means _Call.count and _Call.index are no longer needed.
* add coverage for calling next() on a mock_open with readline.return_value set.
* __aiter__ is defined on the Mock so the one on _AsyncIterator is never called.1 parent a327677 commit db5e86a
File tree
4 files changed
+35
-54
lines changed- Lib/unittest
- test/testmock
4 files changed
+35
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1042 | 1042 | | |
1043 | 1043 | | |
1044 | 1044 | | |
1045 | | - | |
1046 | | - | |
| 1045 | + | |
1047 | 1046 | | |
1048 | 1047 | | |
1049 | 1048 | | |
| |||
1856 | 1855 | | |
1857 | 1856 | | |
1858 | 1857 | | |
1859 | | - | |
| 1858 | + | |
| 1859 | + | |
1860 | 1860 | | |
1861 | 1861 | | |
1862 | 1862 | | |
| |||
2168 | 2168 | | |
2169 | 2169 | | |
2170 | 2170 | | |
2171 | | - | |
| 2171 | + | |
2172 | 2172 | | |
2173 | 2173 | | |
2174 | 2174 | | |
| |||
2541 | 2541 | | |
2542 | 2542 | | |
2543 | 2543 | | |
2544 | | - | |
2545 | | - | |
2546 | | - | |
2547 | | - | |
2548 | | - | |
2549 | | - | |
2550 | 2544 | | |
2551 | 2545 | | |
2552 | 2546 | | |
| |||
2917 | 2911 | | |
2918 | 2912 | | |
2919 | 2913 | | |
2920 | | - | |
2921 | | - | |
2922 | | - | |
2923 | 2914 | | |
2924 | 2915 | | |
2925 | 2916 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
28 | | - | |
| 24 | + | |
29 | 25 | | |
30 | 26 | | |
31 | | - | |
32 | | - | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
36 | | - | |
37 | | - | |
| 31 | + | |
38 | 32 | | |
39 | | - | |
40 | | - | |
| 33 | + | |
41 | 34 | | |
42 | | - | |
43 | | - | |
| 35 | + | |
44 | 36 | | |
45 | | - | |
46 | | - | |
| 37 | + | |
47 | 38 | | |
48 | 39 | | |
49 | | - | |
50 | | - | |
| 40 | + | |
51 | 41 | | |
52 | 42 | | |
53 | 43 | | |
| |||
402 | 392 | | |
403 | 393 | | |
404 | 394 | | |
405 | | - | |
406 | | - | |
| 395 | + | |
407 | 396 | | |
408 | 397 | | |
409 | 398 | | |
410 | 399 | | |
411 | 400 | | |
412 | 401 | | |
413 | 402 | | |
414 | | - | |
415 | | - | |
| 403 | + | |
416 | 404 | | |
417 | 405 | | |
418 | 406 | | |
| |||
553 | 541 | | |
554 | 542 | | |
555 | 543 | | |
556 | | - | |
557 | | - | |
| 544 | + | |
558 | 545 | | |
559 | | - | |
560 | | - | |
| 546 | + | |
561 | 547 | | |
562 | 548 | | |
563 | | - | |
564 | | - | |
| 549 | + | |
565 | 550 | | |
566 | | - | |
567 | | - | |
| 551 | + | |
568 | 552 | | |
569 | 553 | | |
570 | 554 | | |
| |||
673 | 657 | | |
674 | 658 | | |
675 | 659 | | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
| 660 | + | |
684 | 661 | | |
685 | | - | |
| 662 | + | |
686 | 663 | | |
687 | 664 | | |
688 | 665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1868 | 1868 | | |
1869 | 1869 | | |
1870 | 1870 | | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
1871 | 1876 | | |
1872 | 1877 | | |
1873 | 1878 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
770 | 770 | | |
771 | 771 | | |
772 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
773 | 781 | | |
774 | 782 | | |
775 | 783 | | |
| |||
0 commit comments