From da539e5c4d666ae70a7b04f82f6b2f177eecaab5 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Tue, 30 Aug 2022 08:56:24 +0200 Subject: [PATCH] use fixture for test font --- Tests/ttLib/ttFont_test.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Tests/ttLib/ttFont_test.py b/Tests/ttLib/ttFont_test.py index 46aee33dd..8a7b79f75 100644 --- a/Tests/ttLib/ttFont_test.py +++ b/Tests/ttLib/ttFont_test.py @@ -214,6 +214,14 @@ def test_ensureDecompiled(lazy): assert "Lookup" in font["GPOS"].table.LookupList.__dict__ +@pytest.fixture +def testFont_fvar_avar(): + ttxpath = os.path.join(DATA_DIR, "TestTTF_normalizeLocation.ttx") + ttf = TTFont() + ttf.importXML(ttxpath) + return ttf + + @pytest.mark.parametrize( "userLocation, expectedNormalizedLocation", [ @@ -226,9 +234,8 @@ def test_ensureDecompiled(lazy): ({"wght": 700}, {"wght": 1.0}), ], ) -def test_font_normalizeLocation(userLocation, expectedNormalizedLocation): - ttxpath = os.path.join(DATA_DIR, "TestTTF_normalizeLocation.ttx") - ttf = TTFont() - ttf.importXML(ttxpath) - normalizedLocation = ttf.normalizeLocation(userLocation) +def test_font_normalizeLocation( + testFont_fvar_avar, userLocation, expectedNormalizedLocation +): + normalizedLocation = testFont_fvar_avar.normalizeLocation(userLocation) assert expectedNormalizedLocation == normalizedLocation