From a0d35dfb1d47ed6ef6e484ee3f1208b9d88355b8 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Sun, 3 Sep 2023 10:13:58 +0200 Subject: [PATCH] Clean up with helper func --- test-py/test_backend_designspace.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test-py/test_backend_designspace.py b/test-py/test_backend_designspace.py index 83cfabcdb..c94e4269e 100644 --- a/test-py/test_backend_designspace.py +++ b/test-py/test_backend_designspace.py @@ -210,8 +210,7 @@ async def test_newFileSystemBackend(tmpdir, testFont): dsPath = tmpdir / "Test.designspace" font = newFileSystemBackend(dsPath) assert [] == await font.getGlobalAxes() - files = sorted(p.name for p in tmpdir.iterdir()) - assert ["Test.designspace", "Test_Regular.ufo"] == files + assert ["Test.designspace", "Test_Regular.ufo"] == fileNamesFromDir(tmpdir) axes = await testFont.getGlobalAxes() await font.putGlobalAxes(axes) @@ -219,17 +218,21 @@ async def test_newFileSystemBackend(tmpdir, testFont): glyph = await testFont.getGlyph("A") await font.putGlyph("A", glyph, glyphMap["A"]) - glyphFiles = sorted( - p.name for p in (tmpdir / "Test_Regular.ufo" / "glyphs").iterdir() + assert ["A_.glif", "contents.plist"] == fileNamesFromDir( + tmpdir / "Test_Regular.ufo" / "glyphs" ) - assert ["A_.glif", "contents.plist"] == glyphFiles + assert [ "Test.designspace", "Test_BoldCondensed.ufo", "Test_BoldWide.ufo", "Test_LightWide.ufo", "Test_Regular.ufo", - ] == sorted(p.name for p in (tmpdir).iterdir()) + ] == fileNamesFromDir(tmpdir) + + +def fileNamesFromDir(path): + return sorted(p.name for p in path.iterdir()) def unpackSources(sources):