How to use the ufonormalizer.subpathWritePlist function in ufonormalizer

To help you get started, we’ve selected a few ufonormalizer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def test_subpathWritePlist(self):
        expected_data = dict([('a', 'foo'), ('b', 'bar'), ('c', '™')])
        subpathWritePlist(expected_data, self.directory, self.plistname)
        with open(self.plistpath, 'rb') as f:
            data = loads(f.read())
        self.assertEqual(data, expected_data)
github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def _test_normalizeGlyphNames(self, oldGlyphMapping, expectedGlyphMapping):
        import tempfile
        directory = tempfile.mkdtemp()
        layerDirectory = "glyphs"
        fullLayerDirectory = subpathJoin(directory, layerDirectory)
        os.mkdir(fullLayerDirectory)
        for fileName in oldGlyphMapping.values():
            subpathWriteFile("", directory, layerDirectory, fileName)
        self.assertEqual(sorted(os.listdir(fullLayerDirectory)),
                         sorted(oldGlyphMapping.values()))
        subpathWritePlist(oldGlyphMapping, directory, layerDirectory,
                          "contents.plist")
        newGlyphMapping = normalizeGlyphNames(directory, layerDirectory)
        listing = os.listdir(fullLayerDirectory)
        listing.remove("contents.plist")
        self.assertEqual(sorted(listing), sorted(newGlyphMapping.values()))
        self.assertEqual(
            subpathReadPlist(directory, layerDirectory, "contents.plist"),
            newGlyphMapping)
        shutil.rmtree(directory)
        return newGlyphMapping == expectedGlyphMapping
github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def _test_normalizeGlyphNames(self, oldGlyphMapping, expectedGlyphMapping):
        import tempfile
        directory = tempfile.mkdtemp()
        layerDirectory = "glyphs"
        fullLayerDirectory = subpathJoin(directory, layerDirectory)
        os.mkdir(fullLayerDirectory)
        for fileName in oldGlyphMapping.values():
            subpathWriteFile("", directory, layerDirectory, fileName)
        self.assertEqual(sorted(os.listdir(fullLayerDirectory)),
                         sorted(oldGlyphMapping.values()))
        subpathWritePlist(oldGlyphMapping, directory, layerDirectory,
                          "contents.plist")
        newGlyphMapping = normalizeGlyphNames(directory, layerDirectory)
        listing = os.listdir(fullLayerDirectory)
        listing.remove("contents.plist")
        self.assertEqual(sorted(listing), sorted(newGlyphMapping.values()))
        self.assertEqual(
            subpathReadPlist(directory, layerDirectory, "contents.plist"),
            newGlyphMapping)
        shutil.rmtree(directory)
        return newGlyphMapping == expectedGlyphMapping
github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def test_subpathWritePlist(self):
        expected_data = dict([('a', 'foo'), ('b', 'bar'), ('c', '™')])
        subpathWritePlist(expected_data, self.directory, self.plistname)
        with open(self.plistpath, 'rb') as f:
            data = loads(f.read())
        self.assertEqual(data, expected_data)
github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def _test_normalizeGlyphsDirectoryNames(self, oldLayers, expectedLayers):
        directory = tempfile.mkdtemp()
        for layerName, subDirectory in oldLayers:
            os.mkdir(os.path.join(directory, subDirectory))
        self.assertEqual(
            sorted(os.listdir(directory)),
            sorted([oldDirectory for oldName, oldDirectory in oldLayers]))
        subpathWritePlist(oldLayers, directory, "layercontents.plist")
        newLayers = normalizeGlyphsDirectoryNames(directory)
        listing = os.listdir(directory)
        listing.remove("layercontents.plist")
        self.assertEqual(
            sorted(listing),
            sorted([newDirectory for newName, newDirectory in newLayers]))
        shutil.rmtree(directory)
        return newLayers == expectedLayers
github unified-font-object / ufoNormalizer / tests / test_ufonormalizer.py View on Github external
def _test_normalizeGlyphsDirectoryNames(self, oldLayers, expectedLayers):
        directory = tempfile.mkdtemp()
        for layerName, subDirectory in oldLayers:
            os.mkdir(os.path.join(directory, subDirectory))
        self.assertEqual(
            sorted(os.listdir(directory)),
            sorted([oldDirectory for oldName, oldDirectory in oldLayers]))
        subpathWritePlist(oldLayers, directory, "layercontents.plist")
        newLayers = normalizeGlyphsDirectoryNames(directory)
        listing = os.listdir(directory)
        listing.remove("layercontents.plist")
        self.assertEqual(
            sorted(listing),
            sorted([newDirectory for newName, newDirectory in newLayers]))
        shutil.rmtree(directory)
        return newLayers == expectedLayers