Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_complex.py @ 60116:3748bca4d869 legacy-trunk
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
| author | Florent Xicluna <florent.xicluna@gmail.com> |
|---|---|
| date | Wed, 31 Mar 2010 22:01:03 +0000 |
| parents | ff84e0893cb1 |
| children | ed79da3a591c |
line wrap: on
line diff
--- a/Lib/test/test_complex.py Wed Mar 31 21:40:32 2010 +0000 +++ b/Lib/test/test_complex.py Wed Mar 31 22:01:03 2010 +0000 @@ -1,13 +1,6 @@ -import unittest, os +import unittest from test import test_support -import warnings -warnings.filterwarnings( - "ignore", - category=DeprecationWarning, - message=".*complex divmod.*are deprecated" -) - from random import random from math import atan2, isnan, copysign @@ -464,10 +457,7 @@ finally: if (fo is not None) and (not fo.closed): fo.close() - try: - os.remove(test_support.TESTFN) - except (OSError, IOError): - pass + test_support.unlink(test_support.TESTFN) def test_getnewargs(self): self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0)) @@ -613,7 +603,9 @@ self.assertEqual('{0:F}'.format(complex(NAN, NAN)), 'NAN+NANj') def test_main(): - test_support.run_unittest(ComplexTest) + with test_support.check_warnings(("complex divmod.., // and % are " + "deprecated", DeprecationWarning)): + test_support.run_unittest(ComplexTest) if __name__ == "__main__": test_main()
