Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
def collect_meta_classes(bases):
    return collect_attribute('_meta', bases[::-1])
Exemple #4
0
def collect_bases_fields(bases):
    return collect_attribute('base_fields', bases[::-1])