def test_content_type_encoding(self): self.assertEquals(unicode_string_as_utf8, registry.encode( unicode_string, serializer="raw")[-1]) self.assertEquals(latin_string_as_utf8, registry.encode( latin_string, serializer="raw")[-1])
def test_content_type_encoding(self): # Using the "raw" serializer self.assertEquals(unicode_string_as_utf8, registry.encode( unicode_string, serializer="raw")[-1]) self.assertEquals(latin_string_as_utf8, registry.encode( latin_string, serializer="raw")[-1]) # And again w/o a specific serializer to check the # code where we force unicode objects into a string. self.assertEquals(unicode_string_as_utf8, registry.encode(unicode_string)[-1]) self.assertEquals(latin_string_as_utf8, registry.encode(latin_string)[-1])
def test_yaml_encode(self): self.assertEquals(registry.decode( registry.encode(py_data, serializer="yaml")[-1], content_type='application/x-yaml', content_encoding='utf-8'), registry.decode( yaml_data, content_type='application/x-yaml', content_encoding='utf-8'))
def test_json_encode(self): self.assertEquals(registry.decode( registry.encode(py_data, serializer="json")[-1], content_type='application/json', content_encoding='utf-8'), registry.decode( json_data, content_type='application/json', content_encoding='utf-8'))
def test_yaml_encode(self): try: import yaml except ImportError: return say("* PyYAML not installed, will not execute " "related tests.") self.assertEquals(registry.decode( registry.encode(py_data, serializer="yaml")[-1], content_type='application/x-yaml', content_encoding='utf-8'), registry.decode( yaml_data, content_type='application/x-yaml', content_encoding='utf-8'))
def test_msgpack_encode(self): try: import msgpack except ImportError: return say("* msgpack-python not installed, will not execute " "related tests.") self.assertEquals(registry.decode( registry.encode(msgpack_py_data, serializer="msgpack")[-1], content_type='application/x-msgpack', content_encoding='binary'), registry.decode( msgpack_data, content_type='application/x-msgpack', content_encoding='binary'))
def test_pickle_encode(self): self.assertEquals(pickle_data, registry.encode(py_data, serializer="pickle")[-1])