diff options
author | Christian Tismer <tismer@stackless.com> | 2020-12-02 15:13:21 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-12-03 10:36:20 +0000 |
commit | 288fadb796ec4e11e99e3752d531ada7edf15d75 (patch) | |
tree | a64343e629e5d53caa1369d26dddb244e58122d9 /sources/pyside6 | |
parent | 7cb62fa6a72eeed2be8fbb08bdba5508da2e08fe (diff) |
fix both qflags_test and the qflags cppgenerator code
There was a years-old qflags test failing on Python 3.
It was blacklisted with the comment
"# Nested exception in Python 3"
This was nonsense: The test was wrong also for Python 2.
It just happened to work, because Python 2 had some weird
errors leaking. The real bug was in missing error handling
in cppgenerator.cpp .
See the main description in the issue.
Change-Id: Ia0f9466640e0eb33f1b8b26178d33f2be0bcb32f
Task-number: PYSIDE-1442
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6')
-rw-r--r-- | sources/pyside6/tests/QtCore/qflags_test.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sources/pyside6/tests/QtCore/qflags_test.py b/sources/pyside6/tests/QtCore/qflags_test.py index 68d467265..f7bb5033f 100644 --- a/sources/pyside6/tests/QtCore/qflags_test.py +++ b/sources/pyside6/tests/QtCore/qflags_test.py @@ -30,6 +30,7 @@ '''Test cases for QFlags''' +import operator import os import sys import unittest @@ -117,12 +118,13 @@ class QFlagsOnQVariant(unittest.TestCase): class QFlagsWrongType(unittest.TestCase): def testWrongType(self): '''Wrong type passed to QFlags binary operators''' + for op in operator.or_, operator.and_, operator.xor: + for x in '43', 'jabba', QObject, object: + self.assertRaises(TypeError, op, Qt.NoItemFlags, x) + self.assertRaises(TypeError, op, x, Qt.NoItemFlags) + # making sure this actually does not fail all the time + self.assertEqual(operator.or_(Qt.NoItemFlags, 43), 43) - self.assertRaises(TypeError, Qt.NoItemFlags | '43') - self.assertRaises(TypeError, Qt.NoItemFlags & '43') - self.assertRaises(TypeError, 'jabba' & Qt.NoItemFlags) - self.assertRaises(TypeError, 'hut' & Qt.NoItemFlags) - self.assertRaises(TypeError, Qt.NoItemFlags & QObject()) if __name__ == '__main__': unittest.main() |