def test_foldr_order(self): """Test that right fold are applied in the correct order. E.g, foldr(pow, 2, [1, 2, 3]) should be applied like: (3^2) = 9 (2^9) = 512 (1^512) = 1 """ self.assertEqual(foldr(pow, 2, [1, 2, 3]), 1)
def test_foldr_basic(self): """Test that right folds basically work.""" self.assertEqual(foldr(add, 2, [1, 2, 3]), 8)