(self)
| 793 | class TestWarns: |
| 794 | |
| 795 | def test_warn(self): |
| 796 | def f(): |
| 797 | warnings.warn("yo") |
| 798 | return 3 |
| 799 | |
| 800 | before_filters = sys.modules['warnings'].filters[:] |
| 801 | assert_equal(assert_warns(UserWarning, f), 3) |
| 802 | after_filters = sys.modules['warnings'].filters |
| 803 | |
| 804 | assert_raises(AssertionError, assert_no_warnings, f) |
| 805 | assert_equal(assert_no_warnings(lambda x: x, 1), 1) |
| 806 | |
| 807 | # Check that the warnings state is unchanged |
| 808 | assert_equal(before_filters, after_filters, |
| 809 | "assert_warns does not preserver warnings state") |
| 810 | |
| 811 | def test_context_manager(self): |
| 812 |
nothing calls this directly
no test coverage detected