本文整理匯總了Python中traitsui.qt4.clipboard.PyMimeData.data方法的典型用法代碼示例。如果您正苦於以下問題:Python PyMimeData.data方法的具體用法?Python PyMimeData.data怎麽用?Python PyMimeData.data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類traitsui.qt4.clipboard.PyMimeData
的用法示例。
在下文中一共展示了PyMimeData.data方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_pickle
# 需要導入模塊: from traitsui.qt4.clipboard import PyMimeData [as 別名]
# 或者: from traitsui.qt4.clipboard.PyMimeData import data [as 別名]
def test_pickle(self):
md = PyMimeData(data=0)
self.assertEqual(md._local_instance, 0)
self.assertTrue(md.hasFormat(PyMimeData.MIME_TYPE))
self.assertFalse(md.hasFormat(PyMimeData.NOPICKLE_MIME_TYPE))
self.assertEqual(md.data(PyMimeData.MIME_TYPE).data(),
dumps(int) + dumps(0))
示例2: test_cant_pickle
# 需要導入模塊: from traitsui.qt4.clipboard import PyMimeData [as 別名]
# 或者: from traitsui.qt4.clipboard.PyMimeData import data [as 別名]
def test_cant_pickle(self):
unpicklable = lambda: None
md = PyMimeData(data=unpicklable)
self.assertEqual(md._local_instance, unpicklable)
self.assertTrue(md.hasFormat(PyMimeData.NOPICKLE_MIME_TYPE))
self.assertFalse(md.hasFormat(PyMimeData.MIME_TYPE))
self.assertEqual(bytes(md.data(PyMimeData.NOPICKLE_MIME_TYPE)), str(id(unpicklable)))
示例3: test_nopickle
# 需要導入模塊: from traitsui.qt4.clipboard import PyMimeData [as 別名]
# 或者: from traitsui.qt4.clipboard.PyMimeData import data [as 別名]
def test_nopickle(self):
md = PyMimeData(data=0, pickle=False)
self.assertEqual(md._local_instance, 0)
self.assertTrue(md.hasFormat(PyMimeData.NOPICKLE_MIME_TYPE))
self.assertFalse(md.hasFormat(PyMimeData.MIME_TYPE))
self.assertEqual(
md.data(PyMimeData.NOPICKLE_MIME_TYPE).data(),
str2bytes(str(id(0)))
)