def test_release_unheld_lock(self): std_lock = std_allocate_lock() g_lock = allocate_lock() with self.assertRaises(Exception) as exc: std_lock.release() std_exc = exc.exception with self.assertRaises(Exception) as exc: g_lock.release() g_exc = exc.exception self.assertIsInstance(g_exc, type(std_exc))
def test_release_unheld_lock(self): std_lock = std_allocate_lock() g_lock = allocate_lock() try: std_lock.release() self.fail("Should have thrown an exception") except Exception as e: std_exc = e try: g_lock.release() self.fail("Should have thrown an exception") except Exception as e: g_exc = e self.assertTrue(isinstance(g_exc, type(std_exc)), (g_exc, std_exc))
def test_release_unheld_lock(self): std_lock = std_allocate_lock() g_lock = allocate_lock() try: std_lock.release() self.fail("Should have thrown an exception") except Exception as e: std_exc = e try: g_lock.release() self.fail("Should have thrown an exception") except Exception as e: g_exc = e self.assertIsInstance(g_exc, type(std_exc))