# run the test
subprocess.check_call([exe])
+
+def test_user_shapes():
+ '''
+ Graphviz should understand how to embed a custom SVG image as a node’s shape
+ '''
+
+ # find our collocated test case
+ input = Path(__file__).parent / 'usershape.dot'
+ assert input.exists(), 'unexpectedly missing test case'
+
+ # ask Graphviz to translate this to SVG
+ output = subprocess.check_output(['dot', '-Tsvg', input],
+ cwd=os.path.dirname(__file__), universal_newlines=True)
+
+ # the external SVG should have been parsed and is now referenced
+ assert '<image xlink:href="usershape.svg" width="62px" height="44px" ' in \
+ output
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version
+ -->
+<!-- Title: G Pages: 1 -->
+<svg width="62pt" height="44pt"
+ viewBox="0.00 0.00 62.00 44.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 40)">
+<title>G</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-40 58,-40 58,4 -4,4"/>
+<!-- a -->
+<g id="node1" class="node">
+<title>a</title>
+<polygon fill="none" stroke="black" points="27,-36 0,-9 54,-9 27,-36"/>
+</g>
+</g>
+</svg>