def __iter__(self): """ Walk through each given trait. Any class source is walked through for its contents. """ for trait in flatten(map(TraitSource, self.__traits)): yield trait
def test_can_be_flattened(self): flat = flatten(self.classtype) self.assertEqual(sorted([str(f) for f in list(flat)]), ['classmethod', 'method', 'property', 'staticmethod'])