diff options
| author | Christian Tismer <tismer@stackless.com> | 2023-06-09 13:48:44 +0200 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2023-06-16 19:15:31 +0200 |
| commit | 9446e0c8b4711cb886c2449fd8e17dcb26e69b6b (patch) | |
| tree | 85b6e694870f1dd08fd2d84ec781fdb5190118cb /sources/pyside6/tests | |
| parent | 2b75519adf23ba490e32659ca337b48e7ae4ec41 (diff) | |
PyEnum: Update docs and rename the option
The new Enum implementation can no longer be switched off.
Individual features can still be deselected with the
environment variable PYSIDE6_OPTION_PYTHON_ENUM which
had the name PYSIDE63_OPTION_PYTHON_ENUM before.
This change is meant for PySide 6.6 .
Task-number: PYSIDE-1735
Change-Id: Iae5b7a9d42a0d7b005dbba20201a80713ef79be9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/tests')
| -rw-r--r-- | sources/pyside6/tests/QtCore/bug_462.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtCore/bug_826.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtCore/qcbor_test.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtCore/qenum_test.py | 10 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtCore/qflags_test.py | 4 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtCore/qsysinfo_test.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtGui/bug_617.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtGui/qkeysequence_test.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtGui/qpen_test.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/QtSql/qvarianttype_test.py | 2 | ||||
| -rw-r--r-- | sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py | 12 | ||||
| -rw-r--r-- | sources/pyside6/tests/pysidetest/qvariant_test.py | 2 |
12 files changed, 22 insertions, 22 deletions
diff --git a/sources/pyside6/tests/QtCore/bug_462.py b/sources/pyside6/tests/QtCore/bug_462.py index 2f13bb531..275faa215 100644 --- a/sources/pyside6/tests/QtCore/bug_462.py +++ b/sources/pyside6/tests/QtCore/bug_462.py @@ -16,7 +16,7 @@ from PySide6.QtCore import QObject, QCoreApplication, QEvent, QThread class MyEvent(QEvent): def __init__(self, i): print("TYPE:", type(QEvent.User)) - super().__init__(QEvent.Type(QEvent.User + (0 if sys.pyside63_option_python_enum else 100))) + super().__init__(QEvent.Type(QEvent.User + (0 if sys.pyside6_option_python_enum else 100))) self.i = i diff --git a/sources/pyside6/tests/QtCore/bug_826.py b/sources/pyside6/tests/QtCore/bug_826.py index 65b237d24..fd6e03149 100644 --- a/sources/pyside6/tests/QtCore/bug_826.py +++ b/sources/pyside6/tests/QtCore/bug_826.py @@ -33,7 +33,7 @@ class TestEnums(unittest.TestCase): self.assertTrue(QEvent.User <= TestEvent.TestEventType <= QEvent.MaxUser) self.assertTrue(QEvent.User <= TEST_EVENT_TYPE <= QEvent.MaxUser) - @unittest.skipIf(sys.pyside63_option_python_enum, "makes no sense for tested Python enums") + @unittest.skipIf(sys.pyside6_option_python_enum, "makes no sense for tested Python enums") def testUserTypesRepr(self): self.assertEqual(eval(repr(TestEvent.TestEventType)), TestEvent.TestEventType) self.assertEqual(eval(repr(TEST_EVENT_TYPE)), TEST_EVENT_TYPE) diff --git a/sources/pyside6/tests/QtCore/qcbor_test.py b/sources/pyside6/tests/QtCore/qcbor_test.py index edcac6c4b..6b088af17 100644 --- a/sources/pyside6/tests/QtCore/qcbor_test.py +++ b/sources/pyside6/tests/QtCore/qcbor_test.py @@ -56,7 +56,7 @@ class TestCbor(unittest.TestCase): value = QCborValue('hello') self.assertTrue(value.isString()) self.assertEqual(value.toString(), 'hello') - if sys.pyside63_option_python_enum: + if sys.pyside6_option_python_enum: # PYSIDE-1735: Undefined enums are not possible return tag = value.tag(QCborTag(32)) diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py index adcdcbacd..1a0cc857d 100644 --- a/sources/pyside6/tests/QtCore/qenum_test.py +++ b/sources/pyside6/tests/QtCore/qenum_test.py @@ -19,7 +19,7 @@ from PySide6.QtCore import Qt, QIODevice, QObject, QEnum, QFlag class TestEnum(unittest.TestCase): - @unittest.skipIf(sys.pyside63_option_python_enum, "not adequate for new enums to ask the value") + @unittest.skipIf(sys.pyside6_option_python_enum, "not adequate for new enums to ask the value") def testToInt(self): self.assertEqual(QIODevice.NotOpen, 0) self.assertEqual(QIODevice.ReadOnly, 1) @@ -30,7 +30,7 @@ class TestEnum(unittest.TestCase): self.assertEqual(QIODevice.Text, 16) self.assertEqual(QIODevice.Unbuffered, 32) - @unittest.skipIf(sys.pyside63_option_python_enum, "not adequate for new enums to ask the value") + @unittest.skipIf(sys.pyside6_option_python_enum, "not adequate for new enums to ask the value") def testToIntInFunction(self): self.assertEqual(str(int(QIODevice.WriteOnly)), "2") @@ -42,7 +42,7 @@ class TestEnum(unittest.TestCase): self.assertEqual(k - 2, -(2 - k)) self.assertEqual(k * 2, 2 * k) - if not sys.pyside63_option_python_enum: + if not sys.pyside6_option_python_enum: # Floats work fine with new enums with self.assertRaises(TypeError): a = k + 2.0 @@ -53,7 +53,7 @@ class TestEnum(unittest.TestCase): with self.assertRaises(TypeError): a = k * 2.0 - @unittest.skipIf(sys.pyside63_option_python_enum, "inheritance forbidden for Python enums") + @unittest.skipIf(sys.pyside6_option_python_enum, "inheritance forbidden for Python enums") def testInherit(self): class A(Qt.Key): pass @@ -80,7 +80,7 @@ class TestEnum(unittest.TestCase): class TestQFlags(unittest.TestCase): - newenum = sys.pyside63_option_python_enum + newenum = sys.pyside6_option_python_enum def testToItn(self): om = QIODevice.NotOpen diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py index 3b97e649f..c71028daf 100644 --- a/sources/pyside6/tests/QtCore/qflags_test.py +++ b/sources/pyside6/tests/QtCore/qflags_test.py @@ -113,7 +113,7 @@ class QFlagsOnQVariant(unittest.TestCase): class QFlagsWrongType(unittest.TestCase): - @unittest.skipIf(sys.pyside63_option_python_enum, "Qt.ItemFlag is no longer an IntEnum") + @unittest.skipIf(sys.pyside6_option_python_enum, "Qt.ItemFlag is no longer an IntEnum") def testWrongType(self): '''Wrong type passed to QFlags binary operators''' for op in operator.or_, operator.and_, operator.xor: @@ -136,7 +136,7 @@ class QEnumFlagDefault(unittest.TestCase): oldEnum = Qt.AlignmentFlag() self.assertEqual(type(oldFlag), Qt.Alignment) self.assertEqual(type(oldEnum), Qt.AlignmentFlag) - if sys.pyside63_option_python_enum: + if sys.pyside6_option_python_enum: self.assertEqual(type(oldFlag), type(oldEnum)) else: with self.assertRaises(AssertionError): diff --git a/sources/pyside6/tests/QtCore/qsysinfo_test.py b/sources/pyside6/tests/QtCore/qsysinfo_test.py index a25f7d115..30406ebf2 100644 --- a/sources/pyside6/tests/QtCore/qsysinfo_test.py +++ b/sources/pyside6/tests/QtCore/qsysinfo_test.py @@ -14,7 +14,7 @@ from PySide6.QtCore import QSysInfo class TestQSysInfo(unittest.TestCase): - newenum = sys.pyside63_option_python_enum + newenum = sys.pyside6_option_python_enum def testEnumEndian(self): self.assertEqual(QSysInfo.BigEndian.value if self.newenum else QSysInfo.BigEndian, 0) diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py index 59b1a9a4a..b82a41882 100644 --- a/sources/pyside6/tests/QtGui/bug_617.py +++ b/sources/pyside6/tests/QtGui/bug_617.py @@ -28,7 +28,7 @@ class Bug617(unittest.TestCase): def testOutOfBounds(self): e = MyEvent() self.assertEqual(repr(e.type()), "<Type.999: 999>" - if sys.pyside63_option_python_enum else "PySide6.QtCore.QEvent.Type(999)") + if sys.pyside6_option_python_enum else "PySide6.QtCore.QEvent.Type(999)") if __name__ == "__main__": diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py index 66a4916e7..ef717e346 100644 --- a/sources/pyside6/tests/QtGui/qkeysequence_test.py +++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py @@ -20,7 +20,7 @@ class QKeySequenceTest(UsesQApplication): def testGetItemOperator(self): # bug #774 - if sys.pyside63_option_python_enum: + if sys.pyside6_option_python_enum: # PYSIDE-1735: Remapped from Qt.Modifier to Qt.KeyboardModifier # Note that Qt.(Keyboard)?Modifier will be no longer IntFlag. ks = QKeySequence(Qt.ShiftModifier, Qt.ControlModifier, Qt.Key_P, Qt.Key_R) diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py index 84df8c499..c9d57f6c7 100644 --- a/sources/pyside6/tests/QtGui/qpen_test.py +++ b/sources/pyside6/tests/QtGui/qpen_test.py @@ -26,7 +26,7 @@ class Painting(QRasterWindow): with QPainter(self) as painter: painter.setPen(Qt.NoPen) self.penFromEnum = painter.pen() - intVal = Qt.NoPen.value if sys.pyside63_option_python_enum else int(Qt.NoPen) + intVal = Qt.NoPen.value if sys.pyside6_option_python_enum else int(Qt.NoPen) painter.setPen(intVal) self.penFromInteger = painter.pen() QTimer.singleShot(20, self.close) diff --git a/sources/pyside6/tests/QtSql/qvarianttype_test.py b/sources/pyside6/tests/QtSql/qvarianttype_test.py index c2790cabf..afc5fadb9 100644 --- a/sources/pyside6/tests/QtSql/qvarianttype_test.py +++ b/sources/pyside6/tests/QtSql/qvarianttype_test.py @@ -17,7 +17,7 @@ from PySide6.QtSql import QSqlField class QVariantTypeTest(unittest.TestCase): def testQVariantType(self): - new_enum = sys.pyside63_option_python_enum + new_enum = sys.pyside6_option_python_enum cmp_id = QMetaType.QString.value if new_enum else QMetaType.QString f = QSqlField("name", QMetaType(QMetaType.QString)) diff --git a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py index 0dcec5a4c..5ccbfb92e 100644 --- a/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py +++ b/sources/pyside6/tests/pysidetest/pyenum_relax_options_test.py @@ -51,7 +51,7 @@ def runtest(program): def testprog2(option): return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore from enum import IntEnum assert(issubclass(QtCore.Qt.DateFormat, IntEnum)) @@ -59,7 +59,7 @@ def testprog2(option): def testprog4(option): return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore QtCore.QtDebugMsg """)) @@ -67,28 +67,28 @@ def testprog4(option): def testprog8_16(option): # this test needs flag 16, or the effect would be hidden by forgiving mode return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore QtCore.Qt.AlignTop """)) def testprog32(option): return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore QtCore.Qt.Alignment """)) def testprog64(option): return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore QtCore.Qt.AlignmentFlag() """)) def testprog128(option): return runtest(dedent(f""" - sys.pyside63_option_python_enum = {option} + sys.pyside6_option_python_enum = {option} from PySide6 import QtCore QtCore.Qt.Key(1234567) """)) diff --git a/sources/pyside6/tests/pysidetest/qvariant_test.py b/sources/pyside6/tests/pysidetest/qvariant_test.py index df623146d..8676c5eeb 100644 --- a/sources/pyside6/tests/pysidetest/qvariant_test.py +++ b/sources/pyside6/tests/pysidetest/qvariant_test.py @@ -38,7 +38,7 @@ class QVariantTest(UsesQApplication): self.assertEqual(TestObject.checkType(ks), 4107) # PYSIDE-1735: Test the new way to address QKeyCombination after moving IntEnum to Enum - @unittest.skipUnless(sys.pyside63_option_python_enum, "only implemented for new enums") + @unittest.skipUnless(sys.pyside6_option_python_enum, "only implemented for new enums") def testQKeySequenceMoreVariations(self): QAction().setShortcut(Qt.CTRL | Qt.Key_B) QAction().setShortcut(Qt.CTRL | Qt.ALT | Qt.Key_B) |
