Ejemplo n.º 1
0
 def test_named(self):
     e = db.L()['size'] + db.B()['blub'] + FLSE(lookback('size'))['string']
     
     a = e(None)
     m = asynchia.ee.MockHandler(
         inbuf=e.produce((5, 1, b('ABCDE'))) + b('FG')
     )
     until_done(lambda: a.add_data(m, 120))
     
     self.assertEqual(tuple(a.value), (5, 1, b('ABCDE')))
     self.assertEqual(m.inbuf, b('FG'))
Ejemplo n.º 2
0
 def test_mul2(self):
     x = db.B() + db.B() * lookback(0)
     c = x()
     
     prod = x.produce((3, (1, 2, 5)))
     
     self.assertEqual(
         prod,
         struct.pack('!BBBB', 3, 1, 2, 5)
     )
     m = asynchia.ee.MockHandler(prod + b('x'))
     until_done(lambda: c.add_data(m, 10))
     self.assertEqual(exhaust(c.value), [3, [1, 2, 5]])