fonttools/Tests/ttLib/ttCollection_test.py
Cosimo Lupo e1b3bfc807 ttCollection_test: check loading TTCollection with lazy attribute
currently lazy=True fails with 'ValueError: seek of closed file'
2022-03-17 11:43:11 +00:00

15 lines
469 B
Python

import os
from fontTools.ttLib import TTCollection
import pytest
TTX_DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "ttx", "data")
@pytest.mark.parametrize("lazy", [None, True, False])
def test_lazy_open(lazy):
ttc = os.path.join(TTX_DATA_DIR, "TestTTC.ttc")
with TTCollection(ttc, lazy=lazy) as collection:
assert len(collection) == 2
assert collection[0]["maxp"].numGlyphs == 6
assert collection[1]["maxp"].numGlyphs == 6