Example #1
0
    def test_to_dict(self):
        class Bar(object):
            def to_dict(self):
                return {
                    'prop': 'val'
                }

        class Foo(object):
            x = 1
            y = 2
            z = 7
            bar = Bar()
            bar_list = [Bar(), Bar()]

        self.assertEqual(
            {
                'x': 1,
                'y': 2,
                'bar': {'prop': 'val'},
                'bar_list': [{'prop': 'val'}, {'prop': 'val'}]
            },
            util.to_dict(Foo(), ['x', 'y', 'bar', 'bar_list'])
        )
Example #2
0
 def to_dict(self):
     return util.to_dict(self, FailedScheduleItem.TO_DICT_FIELDS)
Example #3
0
 def to_dict(self):
     return util.to_dict(self, SectionMeeting.TO_DICT_FIELDS)
Example #4
0
 def to_dict(self):
     return util.to_dict(self, self.TO_DICT_FIELDS)
Example #5
0
 def to_dict(self):
     return util.to_dict(self, SectionMeeting.TO_DICT_FIELDS)
Example #6
0
 def to_dict(self):
     return util.to_dict(self, self.TO_DICT_FIELDS)