def testOffThreadWrites(self): c = Channel() def WriteStuff(): c.Put(1) c.Put(2) c.Put(3) t = Thread(target=WriteStuff) t.start() self.assertEqual(1, c.Get()) self.assertEqual(2, c.Get()) self.assertEqual(3, c.Get()) c.Close()
def testReadAfterClose(self): c = Channel() c.Close() self.assertEqual(None, c.Get())
def testGetAfterEOF(self): c = Channel() c.Close() self.assertEqual(None, c.Get()) self.assertEqual(None, c.Get())
def testReadWrite(self): c = Channel() c.Put(1) self.assertEqual(1, c.Get()) c.Close()