Upgrade Tests/ufoLib to Python 3.6+ syntax
This commit is contained in:
parent
66dec63231
commit
14bb52a616
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import unittest
|
import unittest
|
||||||
from fontTools.ufoLib.glifLib import GlifLibError, readGlyphFromString, writeGlyphToString
|
from fontTools.ufoLib.glifLib import GlifLibError, readGlyphFromString, writeGlyphToString
|
||||||
from .testSupport import Glyph, stripText
|
from .testSupport import Glyph, stripText
|
||||||
@ -19,7 +18,7 @@ class TestGLIF1(unittest.TestCase):
|
|||||||
first = stripText(first)
|
first = stripText(first)
|
||||||
if isinstance(second, basestring):
|
if isinstance(second, basestring):
|
||||||
second = stripText(second)
|
second = stripText(second)
|
||||||
return super(TestGLIF1, self).assertEqual(first, second, msg=msg)
|
return super().assertEqual(first, second, msg=msg)
|
||||||
|
|
||||||
def pyToGLIF(self, py):
|
def pyToGLIF(self, py):
|
||||||
py = stripText(py)
|
py = stripText(py)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import unittest
|
import unittest
|
||||||
from fontTools.ufoLib.glifLib import GlifLibError, readGlyphFromString, writeGlyphToString
|
from fontTools.ufoLib.glifLib import GlifLibError, readGlyphFromString, writeGlyphToString
|
||||||
from .testSupport import Glyph, stripText
|
from .testSupport import Glyph, stripText
|
||||||
@ -19,7 +18,7 @@ class TestGLIF2(unittest.TestCase):
|
|||||||
first = stripText(first)
|
first = stripText(first)
|
||||||
if isinstance(second, basestring):
|
if isinstance(second, basestring):
|
||||||
second = stripText(second)
|
second = stripText(second)
|
||||||
return super(TestGLIF2, self).assertEqual(first, second, msg=msg)
|
return super().assertEqual(first, second, msg=msg)
|
||||||
|
|
||||||
def pyToGLIF(self, py):
|
def pyToGLIF(self, py):
|
||||||
py = stripText(py)
|
py = stripText(py)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
@ -9,7 +8,7 @@ from fontTools.ufoLib import plistlib
|
|||||||
from .testSupport import fontInfoVersion1, fontInfoVersion2
|
from .testSupport import fontInfoVersion1, fontInfoVersion2
|
||||||
|
|
||||||
|
|
||||||
class TestInfoObject(object): pass
|
class TestInfoObject: pass
|
||||||
|
|
||||||
|
|
||||||
class ReadFontInfoVersion1TestCase(unittest.TestCase):
|
class ReadFontInfoVersion1TestCase(unittest.TestCase):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
@ -9,7 +8,7 @@ from fontTools.ufoLib import plistlib
|
|||||||
from .testSupport import fontInfoVersion2
|
from .testSupport import fontInfoVersion2
|
||||||
|
|
||||||
|
|
||||||
class TestInfoObject(object): pass
|
class TestInfoObject: pass
|
||||||
|
|
||||||
|
|
||||||
class ReadFontInfoVersion2TestCase(unittest.TestCase):
|
class ReadFontInfoVersion2TestCase(unittest.TestCase):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
@ -11,7 +10,7 @@ from fontTools.misc import plistlib
|
|||||||
from .testSupport import fontInfoVersion3
|
from .testSupport import fontInfoVersion3
|
||||||
|
|
||||||
|
|
||||||
class TestInfoObject(object): pass
|
class TestInfoObject: pass
|
||||||
|
|
||||||
|
|
||||||
# --------------
|
# --------------
|
||||||
@ -4310,7 +4309,7 @@ class UFO3WriteDataTestCase(unittest.TestCase):
|
|||||||
# layerinfo.plist
|
# layerinfo.plist
|
||||||
# ---------------
|
# ---------------
|
||||||
|
|
||||||
class TestLayerInfoObject(object):
|
class TestLayerInfoObject:
|
||||||
|
|
||||||
color = guidelines = lib = None
|
color = guidelines = lib = None
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
@ -121,7 +120,7 @@ class ConversionFunctionsTestCase(unittest.TestCase):
|
|||||||
# kerning up conversion
|
# kerning up conversion
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
class TestInfoObject(object): pass
|
class TestInfoObject: pass
|
||||||
|
|
||||||
|
|
||||||
class KerningUpConversionTestCase(unittest.TestCase):
|
class KerningUpConversionTestCase(unittest.TestCase):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from fontTools.misc.py23 import tostr
|
from fontTools.misc.py23 import tostr
|
||||||
from fontTools.ufoLib import UFOReader, UFOWriter, UFOFileStructure
|
from fontTools.ufoLib import UFOReader, UFOWriter, UFOFileStructure
|
||||||
from fontTools.ufoLib.errors import UFOLibError, GlifLibError
|
from fontTools.ufoLib.errors import UFOLibError, GlifLibError
|
||||||
@ -38,7 +37,7 @@ def testufoz():
|
|||||||
yield tmp.getsyspath(TEST_UFOZ)
|
yield tmp.getsyspath(TEST_UFOZ)
|
||||||
|
|
||||||
|
|
||||||
class TestUFOZ(object):
|
class TestUFOZ:
|
||||||
|
|
||||||
def test_read(self, testufoz):
|
def test_read(self, testufoz):
|
||||||
with UFOReader(testufoz) as reader:
|
with UFOReader(testufoz) as reader:
|
||||||
@ -54,7 +53,7 @@ class TestUFOZ(object):
|
|||||||
|
|
||||||
def test_pathlike(testufo):
|
def test_pathlike(testufo):
|
||||||
|
|
||||||
class PathLike(object):
|
class PathLike:
|
||||||
|
|
||||||
def __init__(self, s):
|
def __init__(self, s):
|
||||||
self._path = s
|
self._path = s
|
||||||
@ -84,7 +83,7 @@ def memufo():
|
|||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
||||||
class TestMemoryFS(object):
|
class TestMemoryFS:
|
||||||
|
|
||||||
def test_init_reader(self, memufo):
|
def test_init_reader(self, memufo):
|
||||||
with UFOReader(memufo) as reader:
|
with UFOReader(memufo) as reader:
|
||||||
|
@ -138,7 +138,7 @@ class FileNameTests(unittest.TestCase):
|
|||||||
self.assertEqual(glyphNameToFileName("alt.con", None), "alt._con.glif")
|
self.assertEqual(glyphNameToFileName("alt.con", None), "alt._con.glif")
|
||||||
|
|
||||||
|
|
||||||
class _Glyph(object):
|
class _Glyph:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ def getDemoFontGlyphSetPath():
|
|||||||
|
|
||||||
# GLIF test tools
|
# GLIF test tools
|
||||||
|
|
||||||
class Glyph(object):
|
class Glyph:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.name = None
|
self.name = None
|
||||||
@ -39,11 +39,11 @@ class Glyph(object):
|
|||||||
args = _listToString(args)
|
args = _listToString(args)
|
||||||
kwargs = _dictToString(kwargs)
|
kwargs = _dictToString(kwargs)
|
||||||
if args and kwargs:
|
if args and kwargs:
|
||||||
return "pointPen.%s(*%s, **%s)" % (command, args, kwargs)
|
return f"pointPen.{command}(*{args}, **{kwargs})"
|
||||||
elif len(args):
|
elif len(args):
|
||||||
return "pointPen.%s(*%s)" % (command, args)
|
return f"pointPen.{command}(*{args})"
|
||||||
elif len(kwargs):
|
elif len(kwargs):
|
||||||
return "pointPen.%s(**%s)" % (command, kwargs)
|
return f"pointPen.{command}(**{kwargs})"
|
||||||
else:
|
else:
|
||||||
return "pointPen.%s()" % command
|
return "pointPen.%s()" % command
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ def _dictToString(d):
|
|||||||
value = repr(value)
|
value = repr(value)
|
||||||
elif isinstance(value, basestring):
|
elif isinstance(value, basestring):
|
||||||
value = "\"%s\"" % value
|
value = "\"%s\"" % value
|
||||||
text.append("%s : %s" % (key, value))
|
text.append(f"{key} : {value}")
|
||||||
if not text:
|
if not text:
|
||||||
return ""
|
return ""
|
||||||
return "{%s}" % ", ".join(text)
|
return "{%s}" % ", ".join(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user