Beispiel #1
0
 def test_nested(self):
     list_nested = ListElement(1, 2, ListElement(3, 4))
     add2 = lambda num: num+2
     self.assertRaises(TypeError,
         lambda : list_nested.f_apply(add2)
     )
     self.assertEqual(
         list_nested.f_apply(support_post.apply_recursively(add2)),
         ListElement(3, 4, ListElement(5, 6))
     )
 def test_nested(self):
     list_nested = ListElement(1, 2, ListElement(3, 4))
     def add2(_num):
         return _num + 2
         
     self.assertRaises(TypeError,
         lambda : list_nested.f_apply(add2)
     )
     self.assertEqual(
         list_nested.f_apply(support_post.apply_recursively(add2, guard=ListElement)),
         ListElement(3, 4, ListElement(5, 6))
     )