def test_collect_attribute_ommits_attributes_with_value_None(self): Person = UtilsTest.Person expected = ['john', 'malcolm', 'sara', 'ted'] result = collect_attribute('name', [Person('john'), Person('malcolm'), Person(None), Person('sara'), Person(None), Person('ted')]) self.assertEquals(expected, result)
def test_collect_attribute_collects_attributes_of_the_given_name_of_given_objects_list(self): Person = UtilsTest.Person expected = ['john', 'malcolm', 'sara', 'ted'] result = collect_attribute('name', [Person('john'), Person('malcolm'), Person('sara'), Person('ted')]) self.assertEquals(expected, result)
def collect_meta_classes(bases): return collect_attribute('_meta', bases[::-1])
def collect_bases_fields(bases): return collect_attribute('base_fields', bases[::-1])