Esempio n. 1
0
 def test_write_read(self):
     thing = Thing()
     p = Pipe()
     p.put(thing)
     read = p.reader.get()
     p.close()
     self.assertEqual(read, thing)
Esempio n. 2
0
 def test_write_read(self):
     thing = Thing()
     p = Pipe()
     p.put(thing)
     read = p.reader.get()
     p.close()
     self.assertEqual(read, thing)
Esempio n. 3
0
 def test_multiple_write_read(self):
     things = [Thing(), Thing(), Thing()]
     p = Pipe()
     for t in things:
         p.put(t)
     read = []
     for _ in things:
         read.append(p.reader.get())
     p.close()
     self.assertEqual(read, things)
Esempio n. 4
0
 def test_multiple_write_read(self):
     things = [
         Thing(),
         Thing(),
         Thing()
     ]
     p = Pipe()
     for t in things:
         p.put(t)
     read = []
     for _ in things:
         read.append(p.reader.get())
     p.close()
     self.assertEqual(read, things)
Esempio n. 5
0
 def test_put(self, _open):
     _open.return_value = Mock(), Mock()
     thing = Thing()
     p = Pipe()
     p.put(thing)
     _open.return_value[1].put.assert_called_once_with(thing)
Esempio n. 6
0
 def test_put(self, _open):
     _open.return_value = Mock(), Mock()
     thing = Thing()
     p = Pipe()
     p.put(thing)
     _open.return_value[1].put.assert_called_once_with(thing)