aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtCore/qenum_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/QtCore/qenum_test.py')
-rw-r--r--sources/pyside2/tests/QtCore/qenum_test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtCore/qenum_test.py b/sources/pyside2/tests/QtCore/qenum_test.py
index eccbfac23..ada625f24 100644
--- a/sources/pyside2/tests/QtCore/qenum_test.py
+++ b/sources/pyside2/tests/QtCore/qenum_test.py
@@ -49,6 +49,24 @@ class TestEnum(unittest.TestCase):
def testToIntInFunction(self):
self.assertEqual(str(int(QIODevice.WriteOnly)), "2")
+ def testOperations(self):
+ k = Qt.Key.Key_1
+
+ # Integers
+ self.assertEqual(k + 2, 2 + k)
+ self.assertEqual(k - 2, -(2 - k))
+ self.assertEqual(k * 2, 2 * k)
+
+ # Floats
+ with self.assertRaises(TypeError):
+ a = k+2.0
+
+ with self.assertRaises(TypeError):
+ a = k-2.0
+
+ with self.assertRaises(TypeError):
+ a = k*2.0
+
class TestQFlags(unittest.TestCase):
def testToItn(self):
om = QIODevice.NotOpen