remove redundant overrides of stuff that's aready in unittest in python >=3.7
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 2 Dec 2021 01:44:22 +0000 (17:44 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 2 Dec 2021 01:44:22 +0000 (17:44 -0800)
src/nmutil/formaltest.py

index cc81c7720ff1426ad7d8205090aeabc6caac6dd9..5defaaa9e5a596ba28f447b0d0c72d1596141c08 100644 (file)
@@ -3,8 +3,6 @@ import shutil
 import subprocess
 import textwrap
 import unittest
-import warnings
-from contextlib import contextmanager
 from nmigen.hdl.ast import Statement
 from nmigen.hdl.ir import Fragment
 from nmigen.back import rtlil
@@ -27,31 +25,6 @@ class FHDLTestCase(unittest.TestCase):
             return repr_str.strip()
         self.assertEqual(prepare_repr(repr(obj)), prepare_repr(repr_str))
 
-    @contextmanager
-    def assertRaises(self, exception, msg=None):
-        with super().assertRaises(exception) as cm:
-            yield
-        if msg is not None:
-            # WTF? unittest.assertRaises is completely broken.
-            self.assertEqual(str(cm.exception), msg)
-
-    @contextmanager
-    def assertRaisesRegex(self, exception, regex=None):
-        with super().assertRaises(exception) as cm:
-            yield
-        if regex is not None:
-            # unittest.assertRaisesRegex also seems broken...
-            self.assertRegex(str(cm.exception), regex)
-
-    @contextmanager
-    def assertWarns(self, category, msg=None):
-        with warnings.catch_warnings(record=True) as warns:
-            yield
-        self.assertEqual(len(warns), 1)
-        self.assertEqual(warns[0].category, category)
-        if msg is not None:
-            self.assertEqual(str(warns[0].message), msg)
-
     def assertFormal(self, spec, mode="bmc", depth=1, solver="",
                      base_path="formal_test_temp"):
         path = get_test_path(self, base_path)