diff --git a/Tests/pens/qu2cuPen_test.py b/Tests/pens/qu2cuPen_test.py index 8f05ca7b8..f3f8a3f7c 100644 --- a/Tests/pens/qu2cuPen_test.py +++ b/Tests/pens/qu2cuPen_test.py @@ -160,6 +160,17 @@ class TestQu2CuPen(unittest.TestCase, _TestPenMixin): ], ) + def test_qCurveTo_no_oncurve_points(self): + pen = DummyPen() + cubicpen = Qu2CuPen(pen, MAX_ERR) + cubicpen.qCurveTo((0, 0), (1, 0), (1, 1), (0, 1), None) + cubicpen.closePath() + + self.assertEqual( + str(pen).splitlines(), + ["pen.qCurveTo((0, 0), (1, 0), (1, 1), (0, 1), None)", "pen.closePath()"], + ) + def test_curveTo_1_point(self): pen = DummyPen() cubicpen = Qu2CuPen(pen, MAX_ERR) diff --git a/Tests/pens/utils.py b/Tests/pens/utils.py index 00643161b..4cf71746b 100644 --- a/Tests/pens/utils.py +++ b/Tests/pens/utils.py @@ -226,7 +226,11 @@ def _repr_pen_commands(commands): # cast float to int if there're no digits after decimal point, # and round floats to 12 decimal digits (more than enough) args = [ - tuple((int(v) if int(v) == v else round(v, 12)) for v in pt) + ( + tuple((int(v) if int(v) == v else round(v, 12)) for v in pt) + if pt is not None + else None + ) for pt in args ] args = ", ".join(repr(a) for a in args)