def test_stylesheet(self): dwg = Drawing() dwg.add_stylesheet('test.css', 'Test') f = StringIO() dwg.write(f) result = f.getvalue() f.close() self.assertEqual(result, '<?xml version="1.0" encoding="utf-8" ?>\n' \ '<?xml-stylesheet href="test.css" type="text/css" title="Test" alternate="no" media="screen"?>\n' '<svg baseProfile="full" height="100%" version="1.1" width="100%" '\ 'xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" '\ 'xmlns:xlink="http://www.w3.org/1999/xlink"><defs /></svg>')
def test_stylesheet(self): dwg = Drawing() dwg.add_stylesheet('test.css', 'Test') f = StringIO() dwg.write(f) result = f.getvalue() f.close() self.assertEqual(result, '<?xml version="1.0" encoding="utf-8" ?>\n' '<?xml-stylesheet href="test.css" type="text/css" title="Test" alternate="no" media="screen"?>\n' '<svg baseProfile="full" height="100%" version="1.1" width="100%" ' 'xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" ' 'xmlns:xlink="http://www.w3.org/1999/xlink"><defs /></svg>')
def test_non_us_ascii_chars(self): dwg = Drawing() dwg.set_desc('öäü') f = StringIO() dwg.write(f) result = f.getvalue() f.close() self.assertEqual( result, '<?xml version="1.0" encoding="utf-8" ?>\n' '<svg baseProfile="full" height="100%" version="1.1" width="100%" ' 'xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" ' 'xmlns:xlink="http://www.w3.org/1999/xlink">' '<title>öäü</title><defs /></svg>')
def test_non_us_ascii_chars(self): dwg = Drawing() dwg.set_desc('öäü') f = StringIO() dwg.write(f) result = f.getvalue() f.close() self.assertEqual(result, '<?xml version="1.0" encoding="utf-8" ?>\n' \ '<svg baseProfile="full" height="100%" version="1.1" width="100%" '\ 'xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" '\ 'xmlns:xlink="http://www.w3.org/1999/xlink">' '<title>öäü</title><defs /></svg>')