Remove some Python 2 vestiges from pen tests
This commit is contained in:
parent
f7546baf00
commit
839c57a50d
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.pens.areaPen import AreaPen
|
||||
import unittest
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.pens.basePen import \
|
||||
AbstractPen, BasePen, decomposeSuperBezierSegment, decomposeQuadraticSegment
|
||||
from fontTools.pens.pointPen import AbstractPointPen
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.pens.boundsPen import BoundsPen, ControlBoundsPen
|
||||
import unittest
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
import unittest
|
||||
|
||||
try:
|
||||
@ -48,7 +47,7 @@ class CocoaPenTest(unittest.TestCase):
|
||||
"moveto 50.0 0.0 lineto 50.0 500.0 lineto 200.0 500.0 curveto 350.0 500.0 450.0 400.0 450.0 250.0 curveto 450.0 100.0 350.0 0.0 200.0 0.0 close ",
|
||||
cocoaPathToString(pen.path)
|
||||
)
|
||||
|
||||
|
||||
def test_empty(self):
|
||||
pen = CocoaPen(None)
|
||||
self.assertEqual("", cocoaPathToString(pen.path))
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.pens.perimeterPen import PerimeterPen
|
||||
import unittest
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from io import StringIO
|
||||
from fontTools.pens.pointInsidePen import PointInsidePen
|
||||
import unittest
|
||||
|
||||
@ -72,16 +72,16 @@ class PointInsidePenTest(unittest.TestCase):
|
||||
|
||||
@staticmethod
|
||||
def render(draw_function, even_odd):
|
||||
result = BytesIO()
|
||||
result = StringIO()
|
||||
for y in range(5):
|
||||
for x in range(10):
|
||||
pen = PointInsidePen(None, (x + 0.5, y + 0.5), even_odd)
|
||||
draw_function(pen)
|
||||
if pen.getResult():
|
||||
result.write(b"*")
|
||||
result.write("*")
|
||||
else:
|
||||
result.write(b" ")
|
||||
return tounicode(result.getvalue())
|
||||
result.write(" ")
|
||||
return result.getvalue()
|
||||
|
||||
|
||||
def test_contour_no_solutions(self):
|
||||
|
@ -1,5 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.misc.loggingTools import CapturingLogHandler
|
||||
import unittest
|
||||
|
||||
from fontTools.pens.basePen import AbstractPen
|
||||
@ -60,7 +58,7 @@ def _reprKwargs(kwargs):
|
||||
items = []
|
||||
for key in sorted(kwargs):
|
||||
value = kwargs[key]
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
items.append("%s='%s'" % (key, value))
|
||||
else:
|
||||
items.append("%s=%s" % (key, value))
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
import unittest
|
||||
|
||||
try:
|
||||
@ -68,7 +67,7 @@ class QuartzPenTest(unittest.TestCase):
|
||||
"moveto 50.0 0.0 lineto 50.0 500.0 lineto 200.0 500.0 curveto 350.0 500.0 450.0 400.0 450.0 250.0 curveto 450.0 100.0 350.0 0.0 200.0 0.0 close ",
|
||||
quartzPathToString(pen.path)
|
||||
)
|
||||
|
||||
|
||||
def test_empty(self):
|
||||
pen = QuartzPen(None)
|
||||
self.assertEqual("", quartzPathToString(pen.path))
|
||||
|
@ -1,4 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
from fontTools.pens.t2CharStringPen import T2CharStringPen
|
||||
import unittest
|
||||
|
||||
@ -7,16 +6,12 @@ class T2CharStringPenTest(unittest.TestCase):
|
||||
|
||||
def __init__(self, methodName):
|
||||
unittest.TestCase.__init__(self, methodName)
|
||||
# Python 3 renamed assertRaisesRegexp to assertRaisesRegex,
|
||||
# and fires deprecation warnings if a program uses the old name.
|
||||
if not hasattr(self, "assertRaisesRegex"):
|
||||
self.assertRaisesRegex = self.assertRaisesRegexp
|
||||
|
||||
def assertAlmostEqualProgram(self, expected, actual):
|
||||
self.assertEqual(len(expected), len(actual))
|
||||
for i1, i2 in zip(expected, actual):
|
||||
if isinstance(i1, basestring):
|
||||
self.assertIsInstance(i2, basestring)
|
||||
if isinstance(i1, str):
|
||||
self.assertIsInstance(i2, str)
|
||||
self.assertEqual(i1, i2)
|
||||
else:
|
||||
self.assertAlmostEqual(i1, i2)
|
||||
|
@ -1,5 +1,3 @@
|
||||
from fontTools.misc.py23 import *
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import struct
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
from . import CUBIC_GLYPHS
|
||||
from fontTools.pens.pointPen import PointToSegmentPen, SegmentToPointPen
|
||||
from fontTools.misc.py23 import isclose
|
||||
from math import isclose
|
||||
import unittest
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user