Change ValueError to OpenTypeLibError

This commit is contained in:
Tom Archer 2021-01-20 14:30:49 +00:00
parent 9712407054
commit be898ec6f9
2 changed files with 3 additions and 3 deletions

View File

@ -2575,7 +2575,7 @@ class ClassDefBuilder(object):
self.classes_.add(glyphs) self.classes_.add(glyphs)
for glyph in glyphs: for glyph in glyphs:
if glyph in self.glyphs_: if glyph in self.glyphs_:
raise ValueError(f"Glyph {glyph} is already present in class.") raise OpenTypeLibError(f"Glyph {glyph} is already present in class.", None)
self.glyphs_[glyph] = glyphs self.glyphs_[glyph] = glyphs
def classes(self): def classes(self):

View File

@ -2,7 +2,7 @@ import io
import struct import struct
from fontTools.misc.fixedTools import floatToFixed from fontTools.misc.fixedTools import floatToFixed
from fontTools.misc.testTools import getXML from fontTools.misc.testTools import getXML
from fontTools.otlLib import builder from fontTools.otlLib import builder, error
from fontTools import ttLib from fontTools import ttLib
from fontTools.ttLib.tables import otTables from fontTools.ttLib.tables import otTables
import pytest import pytest
@ -1104,7 +1104,7 @@ class ClassDefBuilderTest(object):
def test_add_exception(self): def test_add_exception(self):
b = builder.ClassDefBuilder(useClass0=True) b = builder.ClassDefBuilder(useClass0=True)
b.add({"a", "b", "c"}) b.add({"a", "b", "c"})
with pytest.raises(ValueError): with pytest.raises(error.OpenTypeLibError):
b.add({"a", "d"}) b.add({"a", "d"})