Пример #1
0
    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()
Пример #2
0
 def testReadAfterClose(self):
     c = Channel()
     c.Close()
     self.assertEqual(None, c.Get())
Пример #3
0
 def testGetAfterEOF(self):
     c = Channel()
     c.Close()
     self.assertEqual(None, c.Get())
     self.assertEqual(None, c.Get())
Пример #4
0
 def testReadWrite(self):
     c = Channel()
     c.Put(1)
     self.assertEqual(1, c.Get())
     c.Close()