diff options
| -rw-r--r-- | sources/pyside2/tests/QtCore/qsrand_test.py | 4 | ||||
| -rw-r--r-- | sources/pyside2/tests/QtGui/qpolygonf_test.py | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sources/pyside2/tests/QtCore/qsrand_test.py b/sources/pyside2/tests/QtCore/qsrand_test.py index cdad78237..03814c950 100644 --- a/sources/pyside2/tests/QtCore/qsrand_test.py +++ b/sources/pyside2/tests/QtCore/qsrand_test.py @@ -35,14 +35,14 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtCore import qsrand +from PySide2.QtCore import QRandomGenerator class OverflowExceptionCollect(unittest.TestCase): '''Test case for OverflowError exception during garbage collection. See bug #147''' def testOverflow(self): # NOTE: PyQt4 raises TypeError, but boost.python raises OverflowError - self.assertRaises(OverflowError, qsrand, 42415335332353253) + self.assertRaises(OverflowError, QRandomGenerator, 42415335332353253) # should not abort if bug #147 is fixed gc.collect() diff --git a/sources/pyside2/tests/QtGui/qpolygonf_test.py b/sources/pyside2/tests/QtGui/qpolygonf_test.py index a21518a7e..d39b44827 100644 --- a/sources/pyside2/tests/QtGui/qpolygonf_test.py +++ b/sources/pyside2/tests/QtGui/qpolygonf_test.py @@ -34,23 +34,26 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtCore import * -from PySide2.QtGui import * +from PySide2.QtCore import QPoint, QPointF +from PySide2.QtGui import QPolygon, QPolygonF + class QPolygonFNotIterableTest(unittest.TestCase): """Test if a QPolygonF is iterable""" - def testIt(self): - p = QPolygonF(4) - self.assertEqual(len(p), 4) + def testIt(self): + points = [] for i in range(0, 4): - p[i] = QPointF(float(i), float(i)) + points.append(QPointF(float(i), float(i))) + + p = QPolygonF(points) + self.assertEqual(len(p), 4) i = 0 for point in p: self.assertEqual(int(point.x()), i) self.assertEqual(int(point.y()), i) - i += 1; + i += 1 def testPolygonShiftOperators(self): p = QPolygon() @@ -58,5 +61,6 @@ class QPolygonFNotIterableTest(unittest.TestCase): p << QPoint(10, 20) << QPoint(20, 30) << [QPoint(20, 30), QPoint(40, 50)] self.assertEqual(len(p), 4) + if __name__ == '__main__': unittest.main() |
