docstr: Helper function to check XML and debug SVG
docstr_tok: ["Helper","function","to","check","XML","and","debug","SVG"]
code: def assertSVG(self, geom, expected, **kwrds):
      """Helper function to check XML and debug SVG"""
      svg_elem = geom.svg(**kwrds)
      try:
          parse_xml_string(svg_elem)
      except Exception:
          raise AssertionError(
              "XML is not valid for SVG element: " + str(svg_elem)
          )
      svg_doc = geom._repr_svg_()
      try:
          doc = parse_xml_string(svg_doc)
      except Exception:
          raise AssertionError(
              "XML is not valid for SVG document: " + str(svg_doc)
          )
      svg_output_dir = None
      # svg_output_dir = '.'  # useful for debugging SVG files
      if svg_output_dir:
          fname = geom.geom_type
          if geom.is_empty:
              fname += "_empty"
          if not geom.is_valid:
              fname += "_invalid"
          if kwrds:
              fname += "_" + ",".join(
                  str(k) + "=" + str(kwrds[k]) for k in kwrds
              )
          svg_path = os.path.join(svg_output_dir, fname + ".svg")
          with open(svg_path, "w") as fp:
              fp.write(doc.toprettyxml())
      assert svg_elem == expected
  
file_path: shapely/shapely/tests/legacy/test_svg.py
imports: import os
  import unittest
  from xml.dom.minidom import parseString
  from shapely.geometry import LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
  from shapely.geometry.collection import GeometryCollection
label_desc: Use image node_id 1 for calling the SvgTestCase obj's underlying member method code with example usage: obj.assertSVG(geom, expected) without return types