Пример #1
0
 def test_ch3(self):
     """
     If ch3 data is received, preppend my name to the list and send it on
     again.
     """
     data = []
     proto = MagicMock()
     p = Channel3Protocol('joe', data.append, proto)
     info = ch3.encode(ch3.fd('jim', 2, 'foo bar'))
     p.childDataReceived(3, '%d:%s,' % (len(info), info))
     self.assertEqual(data[0], ch3.fd('joe.jim', 2, 'foo bar'))
     proto.childDataReceived.assert_called_with(3, '%d:%s,' % (len(info), info))
Пример #2
0
 def test_works(self):
     """
     You can encode and decode things
     """
     r = decode(encode(['foo', 'bar']))
     self.assertEqual(r, ['foo', 'bar'])