コード例 #1
0
 def test_type_error(self):
     try:
         tasks._map_reduce(just_say_hello, range(5),
                           lambda lst, val: lst + [val], [])
     except TypeError as exc:
         # the message depend on the OQ_NO_DISTRIBUTE flag
         self.assertIn('int', str(exc))
     else:
         raise Exception("Exception not raised.")
コード例 #2
0
 def test_type_error(self):
     try:
         tasks._map_reduce(just_say_hello, range(5),
                           lambda lst, val: lst + [val], [])
     except TypeError as exc:
         # the message depend on the OQ_NO_DISTRIBUTE flag
         self.assertIn('int', str(exc))
     else:
         raise Exception("Exception not raised.")
コード例 #3
0
 def test_single_item(self):
     expected = ["hello"] * 5
     result = tasks._map_reduce(
         just_say_hello, [(i, ) for i in range(5)],
         lambda lst, val: lst + [val], [])
     self.assertEqual(expected, result)
コード例 #4
0
 def test_single_item(self):
     expected = ["hello"] * 5
     result = tasks._map_reduce(just_say_hello, [(i, ) for i in range(5)],
                                lambda lst, val: lst + [val], [])
     self.assertEqual(expected, result)