Test absent hex attribute on unicode element

(currently fails)
This commit is contained in:
David Jones 2024-06-03 17:01:20 +01:00
parent 308b449edc
commit c7be064ef6
2 changed files with 32 additions and 0 deletions

View File

@ -300,6 +300,22 @@ class TestGLIF1(unittest.TestCase):
self.assertRaises(GlifLibError, self.pyToGLIF, py) self.assertRaises(GlifLibError, self.pyToGLIF, py)
self.assertRaises(GlifLibError, self.glifToPy, glif) self.assertRaises(GlifLibError, self.glifToPy, glif)
def testUnicodes_hex_present(self):
"""Test that a present <unicode> element must have a
'hex' attribute; by testing that an invalid <unicode>
element raises an appropriate error.
"""
# illegal
glif = """
<glyph name="a" format="1">
<unicode />
<outline>
</outline>
</glyph>
"""
self.assertRaises(GlifLibError, self.glifToPy, glif)
def testNote(self): def testNote(self):
glif = """ glif = """
<glyph name="a" format="1"> <glyph name="a" format="1">

View File

@ -300,6 +300,22 @@ class TestGLIF2(unittest.TestCase):
self.assertRaises(GlifLibError, self.pyToGLIF, py) self.assertRaises(GlifLibError, self.pyToGLIF, py)
self.assertRaises(GlifLibError, self.glifToPy, glif) self.assertRaises(GlifLibError, self.glifToPy, glif)
def testUnicodes_hex_present(self):
"""Test that a present <unicode> element must have a
'hex' attribute; by testing that an invalid <unicode>
element raises an appropriate error.
"""
# illegal
glif = """
<glyph name="a" format="1">
<unicode />
<outline>
</outline>
</glyph>
"""
self.assertRaises(GlifLibError, self.glifToPy, glif)
def testNote(self): def testNote(self):
glif = """ glif = """
<glyph name="a" format="2"> <glyph name="a" format="2">