diff options
author | Rasmus Andersson <rasmus@notion.se> | 2018-09-03 22:55:49 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2018-09-03 22:55:49 +0300 |
commit | c833e252c925e8dd68108660710ca835d95daa6f (patch) | |
tree | 6b2e28264ed45efd7f054e453b622098d0d875b8 /misc/pylib/robofab/test/test_RInfoFL.py | |
parent | 8c1a4c181ef12000179dfec541f1af87e9b03122 (diff) | |
download | inter-c833e252c925e8dd68108660710ca835d95daa6f.tar.xz |
Major overhaul, moving from UFO2 to Glyphs and UFO3, plus a brand new and much simpler fontbuild
Diffstat (limited to 'misc/pylib/robofab/test/test_RInfoFL.py')
-rw-r--r-- | misc/pylib/robofab/test/test_RInfoFL.py | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/misc/pylib/robofab/test/test_RInfoFL.py b/misc/pylib/robofab/test/test_RInfoFL.py deleted file mode 100644 index bfbd13477..000000000 --- a/misc/pylib/robofab/test/test_RInfoFL.py +++ /dev/null @@ -1,111 +0,0 @@ -import unittest -from cStringIO import StringIO -import sys -from robofab import ufoLib -from robofab.objects.objectsFL import NewFont -from robofab.test.testSupport import fontInfoVersion1, fontInfoVersion2 - - -class RInfoRFTestCase(unittest.TestCase): - - def testRoundTripVersion2(self): - font = NewFont() - infoObject = font.info - for attr, value in fontInfoVersion2.items(): - if attr in infoObject._ufoToFLAttrMapping and infoObject._ufoToFLAttrMapping[attr]["nakedAttribute"] is None: - continue - setattr(infoObject, attr, value) - newValue = getattr(infoObject, attr) - self.assertEqual((attr, newValue), (attr, value)) - font.close() - - def testVersion2UnsupportedSet(self): - saveStderr = sys.stderr - saveStdout = sys.stdout - tempStderr = StringIO() - sys.stderr = tempStderr - sys.stdout = tempStderr - font = NewFont() - infoObject = font.info - requiredWarnings = [] - try: - for attr, value in fontInfoVersion2.items(): - if attr in infoObject._ufoToFLAttrMapping and infoObject._ufoToFLAttrMapping[attr]["nakedAttribute"] is not None: - continue - setattr(infoObject, attr, value) - s = "The attribute %s is not supported by FontLab." % attr - requiredWarnings.append((attr, s)) - finally: - sys.stderr = saveStderr - sys.stdout = saveStdout - tempStderr = tempStderr.getvalue() - for attr, line in requiredWarnings: - self.assertEquals((attr, line in tempStderr), (attr, True)) - font.close() - - def testVersion2UnsupportedGet(self): - saveStderr = sys.stderr - saveStdout = sys.stdout - tempStderr = StringIO() - sys.stderr = tempStderr - sys.stdout = tempStderr - font = NewFont() - infoObject = font.info - requiredWarnings = [] - try: - for attr, value in fontInfoVersion2.items(): - if attr in infoObject._ufoToFLAttrMapping and infoObject._ufoToFLAttrMapping[attr]["nakedAttribute"] is not None: - continue - getattr(infoObject, attr, value) - s = "The attribute %s is not supported by FontLab." % attr - requiredWarnings.append((attr, s)) - finally: - sys.stderr = saveStderr - sys.stdout = saveStdout - tempStderr = tempStderr.getvalue() - for attr, line in requiredWarnings: - self.assertEquals((attr, line in tempStderr), (attr, True)) - font.close() - - def testRoundTripVersion1(self): - font = NewFont() - infoObject = font.info - for attr, value in fontInfoVersion1.items(): - if attr not in ufoLib.deprecatedFontInfoAttributesVersion2: - setattr(infoObject, attr, value) - for attr, expectedValue in fontInfoVersion1.items(): - if attr not in ufoLib.deprecatedFontInfoAttributesVersion2: - value = getattr(infoObject, attr) - self.assertEqual((attr, expectedValue), (attr, value)) - font.close() - - def testVersion1DeprecationRoundTrip(self): - saveStderr = sys.stderr - saveStdout = sys.stdout - tempStderr = StringIO() - sys.stderr = tempStderr - sys.stdout = tempStderr - font = NewFont() - infoObject = font.info - requiredWarnings = [] - try: - for attr, value in fontInfoVersion1.items(): - if attr in ufoLib.deprecatedFontInfoAttributesVersion2: - setattr(infoObject, attr, value) - v = getattr(infoObject, attr) - self.assertEquals((attr, value), (attr, v)) - s = "DeprecationWarning: The %s attribute has been deprecated." % attr - requiredWarnings.append((attr, s)) - finally: - sys.stderr = saveStderr - sys.stdout = saveStdout - tempStderr = tempStderr.getvalue() - for attr, line in requiredWarnings: - self.assertEquals((attr, line in tempStderr), (attr, True)) - font.close() - - -if __name__ == "__main__": - from robofab.test.testSupport import runTests - runTests() - |