コード例 #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'])
        )
コード例 #2
0
 def to_dict(self):
     return util.to_dict(self, FailedScheduleItem.TO_DICT_FIELDS)
コード例 #3
0
ファイル: section.py プロジェクト: JGulbronson/rmc
 def to_dict(self):
     return util.to_dict(self, SectionMeeting.TO_DICT_FIELDS)
コード例 #4
0
ファイル: course_alert.py プロジェクト: AliceYuan/rmc
 def to_dict(self):
     return util.to_dict(self, self.TO_DICT_FIELDS)
コード例 #5
0
ファイル: section.py プロジェクト: laurenhcooke/five_six_esps
 def to_dict(self):
     return util.to_dict(self, SectionMeeting.TO_DICT_FIELDS)
コード例 #6
0
 def to_dict(self):
     return util.to_dict(self, self.TO_DICT_FIELDS)