Add a test function similar to the one used in the cairo backend.
Add also the same workaround to handle local includes in python2.
 from math import degrees
 import svgwrite
 from svgwrite.data.types import SVGAttribute
-from .diagram import Diagram
+try:
+    from .diagram import Diagram
+except ValueError:
+    from diagram import Diagram
 
 
 class InkscapeDrawing(svgwrite.Drawing):
 
         # XXX: this is just a very quick and dirty estimate to advance the text
         return self.font_size * len(text) / 2
+
+
+def test():
+    diagram = SvgwriteDiagram(400, 400)
+
+    Diagram.test(diagram)
+
+    diagram.save_svg('svgwrite_diagram_test.svg')
+
+
+if __name__ == "__main__":
+    test()