##// END OF EJS Templates
basic tests for data_pub
MinRK -
Show More
@@ -606,4 +606,25 b' class TestView(ClusterTestCase, ParametricTestCase):'
606 ar = view.apply_async(bar)
606 ar = view.apply_async(bar)
607 r = ar.get(10)
607 r = ar.get(10)
608 self.assertEquals(r, 'foo')
608 self.assertEquals(r, 'foo')
609 def test_data_pub_single(self):
610 view = self.client[-1]
611 ar = view.execute('\n'.join([
612 'from IPython.zmq.datapub import publish_data',
613 'for i in range(5):',
614 ' publish_data(dict(i=i))'
615 ]), block=False)
616 self.assertTrue(isinstance(ar.data, dict))
617 ar.get(5)
618 self.assertEqual(ar.data, dict(i=4))
619
620 def test_data_pub(self):
621 view = self.client[:]
622 ar = view.execute('\n'.join([
623 'from IPython.zmq.datapub import publish_data',
624 'for i in range(5):',
625 ' publish_data(dict(i=i))'
626 ]), block=False)
627 self.assertTrue(all(isinstance(d, dict) for d in ar.data))
628 ar.get(5)
629 self.assertEqual(ar.data, [dict(i=4)] * len(ar))
609
630
General Comments 0
You need to be logged in to leave comments. Login now