Пример #1
0
 def test_write_read(self):
     thing = Thing()
     p = Pipe()
     p.put(thing)
     read = p.reader.get()
     p.close()
     self.assertEqual(read, thing)
Пример #2
0
 def test_write_read(self):
     thing = Thing()
     p = Pipe()
     p.put(thing)
     read = p.reader.get()
     p.close()
     self.assertEqual(read, thing)
Пример #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)
Пример #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)
Пример #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)
Пример #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)