def test_nested_dict(self): self.assertEqual( apply_recursively( [{ 'a': 1, 'b': [2, 3], 'c': { 'd': 4, 'e': None } }, 5], lambda n: n + 1, ), [{ 'a': 2, 'b': [3, 4], 'c': { 'd': 5, 'e': None } }, 6], )
def test_nested_dict(self): self.assertEqual( apply_recursively([{'a': 1, 'b': [2,3], 'c': { 'd': 4, 'e': None }}, 5], lambda n: n+1), [{'a': 2, 'b': [3,4], 'c': { 'd': 5, 'e': None }}, 6] )
def test_nested_tuple(self): self.assertEqual( apply_recursively([(1,2),(3,4)], lambda n: n+1), [[2,3],[4,5]] )
def test_list(self): self.assertEqual( apply_recursively([1,2,3], lambda n: n+1), [2,3,4] )
def test_none(self): self.assertEqual( apply_recursively(None, lambda n: n+1), None )
def test_nested_tuple(self): self.assertEqual( apply_recursively([(1, 2), (3, 4)], lambda n: n + 1), [[2, 3], [4, 5]], )
def test_list(self): self.assertEqual(apply_recursively([1, 2, 3], lambda n: n + 1), [2, 3, 4])
def test_none(self): self.assertEqual(apply_recursively(None, lambda n: n + 1), None)