def test_handle_open_good_closed_bad(self): h = lightgrep.Handle(42) self.assertTrue(h) self.assertEqual(h.handle, 42) h.close() self.assertFalse(h) self.assertEqual(h.handle, None)
def test_get_open(self): h = lightgrep.Handle(42) self.assertEqual(h.get(), 42)
def test_get_closed(self): h = lightgrep.Handle(42) h.close() with self.assertRaises(RuntimeError): h.get()
def test_throwIfClosed_closed(self): h = lightgrep.Handle(42) h.close() with self.assertRaises(RuntimeError): h.throwIfClosed()
def test_throwIfClosed_open(self): h = lightgrep.Handle(42) h.throwIfClosed()