Add tests for functions taking svg objects as string
parent
50b335f3da
commit
33f4639bbf
|
@ -74,7 +74,7 @@ class TestSVG2Paths(unittest.TestCase):
|
||||||
self.assertEqual(len(paths), 2)
|
self.assertEqual(len(paths), 2)
|
||||||
|
|
||||||
def test_from_stringio(self):
|
def test_from_stringio(self):
|
||||||
""" Test reading svg object contained in an StringIO object """
|
""" Test reading svg object contained in a StringIO object """
|
||||||
with open(join(dirname(__file__), 'polygons.svg'), 'r') as file:
|
with open(join(dirname(__file__), 'polygons.svg'), 'r') as file:
|
||||||
# read entire file into string
|
# read entire file into string
|
||||||
file_content: str = file.read()
|
file_content: str = file.read()
|
||||||
|
@ -88,3 +88,23 @@ class TestSVG2Paths(unittest.TestCase):
|
||||||
paths, _ = svg2paths(file_as_stringio)
|
paths, _ = svg2paths(file_as_stringio)
|
||||||
|
|
||||||
self.assertEqual(len(paths), 2)
|
self.assertEqual(len(paths), 2)
|
||||||
|
|
||||||
|
def test_from_string_without_svg_attrs(self):
|
||||||
|
""" Test reading svg object contained in a string without svg attributes"""
|
||||||
|
with open(join(dirname(__file__), 'polygons.svg'), 'r') as file:
|
||||||
|
# read entire file into string
|
||||||
|
file_content: str = file.read()
|
||||||
|
|
||||||
|
paths, _ = svg_string2paths(file_content)
|
||||||
|
|
||||||
|
self.assertEqual(len(paths), 2)
|
||||||
|
|
||||||
|
def test_from_string_with_svg_attrs(self):
|
||||||
|
""" Test reading svg object contained in a string with svg attributes"""
|
||||||
|
with open(join(dirname(__file__), 'polygons.svg'), 'r') as file:
|
||||||
|
# read entire file into string
|
||||||
|
file_content: str = file.read()
|
||||||
|
|
||||||
|
paths, _, _ = svg_string2paths2(file_content)
|
||||||
|
|
||||||
|
self.assertEqual(len(paths), 2)
|
||||||
|
|
Loading…
Reference in New Issue