|
41 | 41 |
|
42 | 42 |
|
43 | 43 | class _DummyObject(object): |
44 | | - |
45 | 44 | def __init__(self, value="x"): |
46 | 45 | self.value = value |
47 | 46 |
|
@@ -253,7 +252,7 @@ def test_assert_almost_equal__not_similar__delta__custom_message(self): |
253 | 252 |
|
254 | 253 | def test_assert_almost_equal__wrong_types(self): |
255 | 254 | try: |
256 | | - assert_almost_equal("5", "5") |
| 255 | + assert_almost_equal("5", "5") # type: ignore |
257 | 256 | except TypeError: |
258 | 257 | pass |
259 | 258 | else: |
@@ -336,7 +335,7 @@ def test_assert_not_almost_equal__similar__delta__custom_message(self): |
336 | 335 |
|
337 | 336 | def test_assert_not_almost_equal__wrong_types(self): |
338 | 337 | try: |
339 | | - assert_not_almost_equal("5", "5") |
| 338 | + assert_not_almost_equal("5", "5") # type: ignore |
340 | 339 | except TypeError: |
341 | 340 | pass |
342 | 341 | else: |
@@ -643,8 +642,7 @@ def test_assert_not_is_instance__custom_message__multiple_types(self): |
643 | 642 |
|
644 | 643 | def test_assert_has_attr__has_attribute(self): |
645 | 644 | d = _DummyObject() |
646 | | - d.foo = 5 |
647 | | - assert_has_attr(d, "foo") |
| 645 | + assert_has_attr(d, "value") |
648 | 646 |
|
649 | 647 | def test_assert_has_attr__does_not_have_attribute__default_message(self): |
650 | 648 | d = _DummyObject() |
@@ -961,20 +959,22 @@ def test_assert_warns__multiple_warnings(self): |
961 | 959 | warn("baz", FutureWarning) |
962 | 960 |
|
963 | 961 | def test_assert_warns__warning_handler_deinstalled_on_success(self): |
964 | | - with catch_warnings(record=1) as warnings: |
| 962 | + with catch_warnings(record=True) as warnings: |
965 | 963 | with assert_warns(UserWarning): |
966 | 964 | warn("foo", UserWarning) |
| 965 | + assert warnings is not None |
967 | 966 | assert_equal(0, len(warnings)) |
968 | 967 | warn("bar", UserWarning) |
969 | 968 | assert_equal(1, len(warnings)) |
970 | 969 |
|
971 | 970 | def test_assert_warns__warning_handler_deinstalled_on_failure(self): |
972 | | - with catch_warnings(record=1) as warnings: |
| 971 | + with catch_warnings(record=True) as warnings: |
973 | 972 | try: |
974 | 973 | with assert_warns(UserWarning): |
975 | 974 | pass |
976 | 975 | except AssertionError: |
977 | 976 | pass |
| 977 | + assert warnings is not None |
978 | 978 | assert_equal(0, len(warnings)) |
979 | 979 | warn("bar", UserWarning) |
980 | 980 | assert_equal(1, len(warnings)) |
@@ -1016,20 +1016,22 @@ def test_assert_warns_regex__multiple_warnings(self): |
1016 | 1016 | warn("baz", FutureWarning) |
1017 | 1017 |
|
1018 | 1018 | def test_assert_warns_regex__warning_handler_deinstalled_on_success(self): |
1019 | | - with catch_warnings(record=1) as warnings: |
| 1019 | + with catch_warnings(record=True) as warnings: |
1020 | 1020 | with assert_warns_regex(UserWarning, r"foo"): |
1021 | 1021 | warn("foo", UserWarning) |
| 1022 | + assert warnings is not None |
1022 | 1023 | assert_equal(0, len(warnings)) |
1023 | 1024 | warn("bar", UserWarning) |
1024 | 1025 | assert_equal(1, len(warnings)) |
1025 | 1026 |
|
1026 | 1027 | def test_assert_warns_regex__warning_handler_deinstalled_on_failure(self): |
1027 | | - with catch_warnings(record=1) as warnings: |
| 1028 | + with catch_warnings(record=True) as warnings: |
1028 | 1029 | try: |
1029 | 1030 | with assert_warns_regex(UserWarning, r""): |
1030 | 1031 | pass |
1031 | 1032 | except AssertionError: |
1032 | 1033 | pass |
| 1034 | + assert warnings is not None |
1033 | 1035 | assert_equal(0, len(warnings)) |
1034 | 1036 | warn("bar", UserWarning) |
1035 | 1037 | assert_equal(1, len(warnings)) |
|
0 commit comments