def test_split(self): T = namedtuple('T', ['friends', 'children']) x = T(['alice', 'bob'], [T(['carrie'], [T(['dan'], [])]), T(['ellen'], [])]) self.assertEqual( list(iterutils.recursive_walk(x, 'friends', 'children')), ['alice', 'bob', 'carrie', 'dan', 'ellen'])
def test_unified(self): T = namedtuple('T', ['children']) x = T([T([T([])]), T([])]) self.assertEqual(list(iterutils.recursive_walk(x, 'children')), [T([T([])]), T([]), T([])])