diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-03 11:14:55 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-04 05:26:18 +0000 |
commit | f47818b5c710aa6ae5f76809046105cb8c3d9f7f (patch) | |
tree | c83b7acb7d19203519bd70a899bb8c4b23997b7e /sources/pyside2/tests/QtWidgets | |
parent | e796600c9663a26ccf1929aca8336eb0cb23fe5d (diff) |
Remove Python2 from PySide2 tests
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Idc6c185c0c848476a60d91b802af760fc2b70a30
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests/QtWidgets')
4 files changed, 5 insertions, 19 deletions
diff --git a/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py index 8e291bb63..8699c7971 100644 --- a/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py +++ b/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py @@ -34,8 +34,6 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -import py3kcompat as py3k - from PySide2.QtCore import QSizeF, QTimer from PySide2.QtGui import QTextFormat, QTextCharFormat, QPyTextObject from PySide2.QtWidgets import QTextEdit @@ -60,7 +58,7 @@ class QAbstractTextDocumentLayoutTest(UsesQApplication): fmt.setObjectType(QAbstractTextDocumentLayoutTest.objectType) cursor = self.textEdit.textCursor() - cursor.insertText(py3k.unichr(0xfffc), fmt) + cursor.insertText(chr(0xfffc), fmt) self.textEdit.setTextCursor(cursor) self.textEdit.close() diff --git a/sources/pyside2/tests/QtWidgets/qimage_test.py b/sources/pyside2/tests/QtWidgets/qimage_test.py index 8bb83c51a..11b9d2193 100644 --- a/sources/pyside2/tests/QtWidgets/qimage_test.py +++ b/sources/pyside2/tests/QtWidgets/qimage_test.py @@ -36,7 +36,6 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -import py3kcompat as py3k from PySide2.QtGui import * from PySide2.QtWidgets import * from helper.helper import adjust_filename @@ -292,17 +291,11 @@ class QImageTest(UsesQApplication): data2 = img1.scanLine(0) self.assertEqual(data1, data2) - # PySide python 3.x does not support slice yet - if not py3k.IS_PY3K: - buff = py3k.buffer(img0.bits()[:img0.bytesPerLine()]) - self.assertEqual(data1, buff) - self.assertEqual(data2, buff) - def testEmptyBuffer(self): - img = QImage(py3k.buffer(''), 100, 100, QImage.Format_ARGB32) + img = QImage(bytes('', "UTF-8"), 100, 100, QImage.Format_ARGB32) def testEmptyStringAsBuffer(self): - img = QImage(py3k.b(''), 100, 100, QImage.Format_ARGB32) + img = QImage(bytes('', "UTF-8"), 100, 100, QImage.Format_ARGB32) def testXpmConstructor(self): label = QLabel() diff --git a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py index 79842aac2..a8b572d05 100644 --- a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py +++ b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py @@ -39,7 +39,6 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -import py3kcompat as py3k from helper.usesqapplication import UsesQApplication from PySide2.QtGui import QAction, QKeySequence @@ -56,7 +55,7 @@ class QStringQKeySequenceTest(UsesQApplication): def testPythonStringAsQKeySequence(self): '''Passes a Python string to an argument expecting a QKeySequence.''' - keyseq = py3k.unicode_('Ctrl+A') + keyseq = 'Ctrl+A' action = QAction(None) action.setShortcut(keyseq) shortcut = action.shortcut() diff --git a/sources/pyside2/tests/QtWidgets/wrong_return_test.py b/sources/pyside2/tests/QtWidgets/wrong_return_test.py index d95ae7639..27b5309e9 100644 --- a/sources/pyside2/tests/QtWidgets/wrong_return_test.py +++ b/sources/pyside2/tests/QtWidgets/wrong_return_test.py @@ -37,7 +37,6 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -import py3kcompat as py3k from PySide2 import QtWidgets from helper.usesqapplication import UsesQApplication @@ -56,10 +55,7 @@ class testCase(UsesQApplication): def testVirtualReturn(self): w = MyWidget() - if py3k.IS_PY3K: - self.assertWarns(RuntimeWarning, w.show) - else: - self.assertRaises(RuntimeWarning, w.show) + self.assertWarns(RuntimeWarning, w.show) if __name__ == '__main__': |