@@ -97,34 +97,34 @@ def test_2_protocol_registration(self):
97
97
98
98
def test_3_registration_for_objects (self ):
99
99
"""i.e. test if a new serializer can be registered for a specific property, action or event"""
100
- Serializers .register_content_type_for_object (TestThing .test_property , 'application/octet-stream' )
101
- Serializers .register_content_type_for_object (TestThing .test_echo , 'x-msgpack' )
100
+ Serializers .register_content_type_for_object (TestThing .base_property , 'application/octet-stream' )
101
+ Serializers .register_content_type_for_object (TestThing .action_echo , 'x-msgpack' )
102
102
Serializers .register_content_type_for_object (TestThing .test_event , 'application/yaml' )
103
103
104
- self .assertEqual (Serializers .for_object (None , 'TestThing' , 'test_echo ' ), Serializers .msgpack )
105
- self .assertEqual (Serializers .for_object (None , 'TestThing' , 'test_property ' ), Serializers .pickle )
104
+ self .assertEqual (Serializers .for_object (None , 'TestThing' , 'action_echo ' ), Serializers .msgpack )
105
+ self .assertEqual (Serializers .for_object (None , 'TestThing' , 'base_property ' ), Serializers .pickle )
106
106
self .assertEqual (Serializers .for_object (None , 'TestThing' , 'test_event' ), Serializers .yaml )
107
107
self .assertEqual (Serializers .for_object (None , 'TestThing' , 'test_unknown_property' ), Serializers .default )
108
108
109
109
110
110
def test_4_registration_for_objects_by_name (self ):
111
111
112
- Serializers .register_content_type_for_object_per_thing_instance ('test_thing' , 'test_property ' ,
112
+ Serializers .register_content_type_for_object_per_thing_instance ('test_thing' , 'base_property ' ,
113
113
'application/yaml' )
114
- self .assertIsInstance (Serializers .for_object ('test_thing' , None , 'test_property ' ),
114
+ self .assertIsInstance (Serializers .for_object ('test_thing' , None , 'base_property ' ),
115
115
self .YAMLSerializer )
116
116
117
117
118
118
def test_5_registration_dict (self ):
119
119
"""test the dictionary where all serializers are stored"""
120
120
# depends on test 3
121
121
self .assertIn ('test_thing' , Serializers .object_content_type_map )
122
- self .assertIn ('test_property ' , Serializers .object_content_type_map ['test_thing' ])
123
- self .assertEqual (Serializers .object_content_type_map ['test_thing' ]['test_property ' ],
122
+ self .assertIn ('base_property ' , Serializers .object_content_type_map ['test_thing' ])
123
+ self .assertEqual (Serializers .object_content_type_map ['test_thing' ]['base_property ' ],
124
124
'application/yaml' )
125
125
126
- self .assertIn ('test_echo ' , Serializers .object_content_type_map ['TestThing' ])
127
- self .assertEqual (Serializers .object_content_type_map ['TestThing' ]['test_echo ' ],
126
+ self .assertIn ('action_echo ' , Serializers .object_content_type_map ['TestThing' ])
127
+ self .assertEqual (Serializers .object_content_type_map ['TestThing' ]['action_echo ' ],
128
128
'x-msgpack' )
129
129
self .assertIn ('test_event' , Serializers .object_content_type_map ['TestThing' ])
130
130
self .assertEqual (Serializers .object_content_type_map ['TestThing' ]['test_event' ],
@@ -133,11 +133,11 @@ def test_5_registration_dict(self):
133
133
134
134
def test_6_retrieval (self ):
135
135
# added in previous tests
136
- self .assertIsInstance (Serializers .for_object ('test_thing' , None , 'test_property ' ), self .YAMLSerializer )
136
+ self .assertIsInstance (Serializers .for_object ('test_thing' , None , 'base_property ' ), self .YAMLSerializer )
137
137
# unknown object should retrieve the default serializer
138
138
self .assertEqual (Serializers .for_object ('test_thing' , None , 'test_unknown_property' ), Serializers .default )
139
139
# unknown thing should retrieve the default serializer
140
- self .assertEqual (Serializers .for_object ('test_unknown_thing' , None , 'test_property ' ), Serializers .default )
140
+ self .assertEqual (Serializers .for_object ('test_unknown_thing' , None , 'base_property ' ), Serializers .default )
141
141
142
142
143
143
def test_7_set_default (self ):
0 commit comments