aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qtcore
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-01-27 16:59:56 -0200
committerHugo Lima <hugo.lima@openbossa.org>2010-01-27 16:59:56 -0200
commit3592cd622e61ee689b096c99d46b6d936109e383 (patch)
treea436899e39d55efaab60cb292d17948cdad71a53 /tests/qtcore
parent8cd100beee09b2bd8305e124fb52fc1f5025584c (diff)
Revert "We do not support character buffer protocol on QStrings."
This reverts commit 1a7cbb2473327abad936447c47818ee13df2992c.
Diffstat (limited to 'tests/qtcore')
-rwxr-xr-xtests/qtcore/qstring_buffer_protocol_test.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/qtcore/qstring_buffer_protocol_test.py b/tests/qtcore/qstring_buffer_protocol_test.py
new file mode 100755
index 000000000..6ce6167dc
--- /dev/null
+++ b/tests/qtcore/qstring_buffer_protocol_test.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+'''Tests QString implementation of Python buffer protocol'''
+
+import unittest
+
+from os.path import isdir
+from PySide.QtCore import QString
+
+class QStringBufferProtocolTest(unittest.TestCase):
+ '''Tests QString implementation of Python buffer protocol'''
+
+ def testQStringBufferProtocol(self):
+ #Tests QString implementation of Python buffer protocol using the os.path.isdir
+ #function which an unicode object or other object implementing the Python buffer protocol
+ os_path_isdir_function_correctly_called_with_a_qstring = True
+ try:
+ isdir(QString('/tmp'))
+ except:
+ os_path_isdir_function_correctly_called_with_a_qstring = False
+ self.assertTrue(os_path_isdir_function_correctly_called_with_a_qstring)
+
+if __name__ == '__main__':
+ unittest.main()
+