Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_normalizeGlif_contour_format1_implied_anchor_without_name(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertEqual(
sorted(_normalizeGlifContourFormat1(element).items()),
[('type', 'anchor'), ('x', 0.0), ('y', 0.0)])
def test_normalizeGlif_contour_format1_implied_anchor(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertEqual(
sorted(_normalizeGlifContourFormat1(element).items()),
[('name', 'anchor1'), ('type', 'anchor'), ('x', 0.0), ('y', 0.0)])
def test_normalizeGlif_contour_format1_unkown_child_element(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertIsNone(_normalizeGlifContourFormat1(element))
result = _normalizeGlifContourFormat1(element)
result["type"]
'contour'
self.assertEqual(len(result["points"]), 1)
self.assertEqual(
sorted(result["points"][0].items()),
[('type', 'line'), ('x', 0.0), ('y', 0.0)])
contour = '''
'''
element = ET.fromstring(contour)
result = _normalizeGlifContourFormat1(element)
result["type"]
'contour'
self.assertEqual(len(result["points"]), 2)
self.assertEqual(
sorted(result["points"][0].items()),
[('type', 'move'), ('x', 0.0), ('y', 0.0)])
self.assertEqual(
sorted(result["points"][1].items()),
[('type', 'line'), ('x', 1.0), ('y', 1.0)])
def test_normalizeGlif_contour_format1_empty(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertIsNone(_normalizeGlifContourFormat1(element))
contour = '''
'''
element = ET.fromstring(contour)
self.assertIsNone(_normalizeGlifContourFormat1(element))
def test_normalizeGlif_contour_format1_implied_anchor_with_empty_name(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertEqual(
sorted(_normalizeGlifContourFormat1(element).items()),
[('name', ''), ('type', 'anchor'), ('x', 0.0), ('y', 0.0)])
def test_normalizeGlif_contour_format1_implied_anchor(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertEqual(
sorted(_normalizeGlifContourFormat1(element).items()),
[('name', 'anchor1'), ('type', 'anchor'), ('x', 0.0), ('y', 0.0)])
def test_normalizeGlif_contour_format1_unkown_point_type(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertIsNone(_normalizeGlifContourFormat1(element))
def test_normalizeGlif_contour_format1_implied_anchor_without_name(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertEqual(
sorted(_normalizeGlifContourFormat1(element).items()),
[('type', 'anchor'), ('x', 0.0), ('y', 0.0)])
def test_normalizeGlif_contour_format1_point_without_attributes(self):
contour = '''
'''
element = ET.fromstring(contour)
self.assertIsNone(_normalizeGlifContourFormat1(element))