def test_mimedata_roundtrip(self): data_wrapper = DataWrapper() data_wrapper.set_mimedata('text/plain', b'hello world') result = data_wrapper.get_mimedata('text/plain') self.assertEqual(data_wrapper.mimetypes(), {'text/plain'}) self.assertEqual(result, b'hello world')
def test_set_format(self): data_wrapper = DataWrapper() format = text_format() data_wrapper.set_format(format, 'hëllø wørld') result = data_wrapper.get_mimedata('text/plain') self.assertEqual(data_wrapper.mimetypes(), {'text/plain'}) self.assertEqual(result, 'hëllø wørld'.encode('utf-8'))
def test_instantiate(self): data_wrapper = DataWrapper() self.assertEqual(data_wrapper.mimetypes(), set())