コード例 #1
0
ファイル: test_serializer.py プロジェクト: gaorlov/serializer
 def test_serializer_can_define_methods(self):
     result_dict = MethodizedSerializer(OtherModel()).to_dict()
     assert_equals("poops", result_dict['custom_field'])
コード例 #2
0
ファイル: test_serializer.py プロジェクト: gaorlov/serializer
 def test_serializer_methods_can_be_keyed(self):
     result_dict = MethodizedSerializer(OtherModel(), {
         'lol': "thing"
     }).to_dict()
     assert_equals("lol", result_dict['kek'])
     assert_equals({'pass_through': {'lol': "thing"}}, result_dict['base'])
コード例 #3
0
ファイル: test_serializer.py プロジェクト: gaorlov/serializer
 def test_serializer_methods_shadow_object_methods(self):
     result_dict = MethodizedSerializer(OtherModel(), {
         'lol': "thing"
     }).to_dict()
     assert_equals('overridden func: lol', result_dict['func'])
コード例 #4
0
ファイル: test_serializer.py プロジェクト: gaorlov/serializer
 def test_serializer_passes_through_optional_args(self):
     result_dict = MethodizedSerializer(OtherModel(), {
         'lol': "thing"
     }).to_dict()
     assert_equals("object.here:poops, args['lol']:thing",
                   result_dict['custom_field_with_args'])