コード例 #1
0
    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')
コード例 #2
0
    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'))
コード例 #3
0
 def test_instantiate(self):
     data_wrapper = DataWrapper()
     self.assertEqual(data_wrapper.mimetypes(), set())