(self)
| 1155 | class TestWarns: |
| 1156 | |
| 1157 | def test_warn(self): |
| 1158 | def f(): |
| 1159 | warnings.warn("yo") |
| 1160 | return 3 |
| 1161 | |
| 1162 | before_filters = sys.modules['warnings'].filters[:] |
| 1163 | assert_equal(assert_warns(UserWarning, f), 3) |
| 1164 | after_filters = sys.modules['warnings'].filters |
| 1165 | |
| 1166 | assert_raises(AssertionError, assert_no_warnings, f) |
| 1167 | assert_equal(assert_no_warnings(lambda x: x, 1), 1) |
| 1168 | |
| 1169 | # Check that the warnings state is unchanged |
| 1170 | assert_equal(before_filters, after_filters, |
| 1171 | "assert_warns does not preserver warnings state") |
| 1172 | |
| 1173 | def test_context_manager(self): |
| 1174 |
nothing calls this directly
no test coverage detected