Ejemplo n.º 1
0
    def add_tests(cls, testable):
        files = test_helpers.glyphs_files(directory(testable))
        for index, filename in enumerate(sorted(files)):

            def test_method(self, filename=filename):
                self.assertParseWriteRoundtrip(filename)

            file_basename = os.path.basename(filename)
            test_name = "test_n{0:0>3d}_{1}_v{2}_{3}".format(
                index, testable['name'], test_helpers.app_version(filename),
                file_basename.replace(r'[^a-zA-Z]', ''))
            test_method.__name__ = test_name
            setattr(cls, test_name, test_method)
Ejemplo n.º 2
0
    def add_tests(cls, testable):
        files = test_helpers.glyphs_files(directory(testable))
        for index, filename in enumerate(sorted(files)):

            def test_method(self, filename=filename):
                with open(filename) as f:
                    font = glyphsLib.load(f)
                self.assertUFORoundtrip(font)

            file_basename = os.path.basename(filename)
            test_name = "test_n{:0>3d}_{}_v{}_{}".format(
                index,
                testable["name"],
                test_helpers.app_version(filename),
                file_basename.replace(r"[^a-zA-Z]", ""),
            )
            test_method.__name__ = test_name
            setattr(cls, test_name, test_method)