예제 #1
0
 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)
예제 #2
0
 def test_get_open(self):
     h = lightgrep.Handle(42)
     self.assertEqual(h.get(), 42)
예제 #3
0
 def test_get_closed(self):
     h = lightgrep.Handle(42)
     h.close()
     with self.assertRaises(RuntimeError):
         h.get()
예제 #4
0
 def test_throwIfClosed_closed(self):
     h = lightgrep.Handle(42)
     h.close()
     with self.assertRaises(RuntimeError):
         h.throwIfClosed()
예제 #5
0
 def test_throwIfClosed_open(self):
     h = lightgrep.Handle(42)
     h.throwIfClosed()