test: remove FHDLTestCase.assertRaisesRegex.
This method is only there because I misunderstood the documentation of unittest.
This commit is contained in:
parent
8dd28fecc6
commit
fd5ee548b6
|
@ -764,13 +764,13 @@ class ArrayTestCase(FHDLTestCase):
|
|||
v1 = a[s1]
|
||||
v2 = a[s2]
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
regex=r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
a[1] = 2
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
regex=r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
del a[1]
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
regex=r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
r"^Array can no longer be mutated after it was indexed with a value at "):
|
||||
a.insert(1, 2)
|
||||
|
||||
def test_repr(self):
|
||||
|
|
|
@ -582,7 +582,7 @@ class SimulatorIntegrationTestCase(FHDLTestCase):
|
|||
def process():
|
||||
nonlocal survived
|
||||
with self.assertRaisesRegex(TypeError,
|
||||
regex=r"Received unsupported command 1 from process .+?"):
|
||||
r"Received unsupported command 1 from process .+?"):
|
||||
yield 1
|
||||
yield Settle()
|
||||
survived = True
|
||||
|
@ -774,7 +774,7 @@ class SimulatorIntegrationTestCase(FHDLTestCase):
|
|||
sim.add_clock(1e-6)
|
||||
sim.run_until(1e-5)
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
regex=r"^Cannot start writing waveforms after advancing simulation time$"):
|
||||
r"^Cannot start writing waveforms after advancing simulation time$"):
|
||||
with sim.write_vcd(open(os.path.devnull, "wt")):
|
||||
pass
|
||||
|
||||
|
@ -785,7 +785,7 @@ class SimulatorIntegrationTestCase(FHDLTestCase):
|
|||
sim = Simulator(m)
|
||||
sim.add_clock(1e-6)
|
||||
with self.assertRaisesRegex(ValueError,
|
||||
regex=r"^Already writing waveforms to .+$"):
|
||||
r"^Already writing waveforms to .+$"):
|
||||
with sim.write_vcd(open(os.path.devnull, "wt")):
|
||||
with sim.write_vcd(open(os.path.devnull, "wt")):
|
||||
pass
|
||||
|
|
|
@ -36,14 +36,6 @@ class FHDLTestCase(unittest.TestCase):
|
|||
# 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:
|
||||
|
|
Loading…
Reference in a new issue