From: Matthew Fernandez Date: Sat, 29 May 2021 19:52:59 +0000 (-0700) Subject: add a test case for #2078 X-Git-Tag: 2.47.3~15^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7b270b512cc355f6b7cfbc4e9020541da458e1f;p=graphviz add a test case for #2078 --- diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 5d6a625d0..f400239ef 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -790,6 +790,32 @@ def test_2057(): ret, _, _ = run_c(c_src, link=["gvc"]) assert ret == 0 +@pytest.mark.xfail(strict=True) +def test_2078(): + """ + Incorrectly using the "layout" attribute on a subgraph should result in a + sensible error. + https://gitlab.com/graphviz/graphviz/-/issues/2078 + """ + + # our sample graph that incorrectly uses layout + input = "graph {\n" \ + " subgraph {\n" \ + " layout=osage\n" \ + " }\n" \ + "}" + + # run it through Graphviz + p = subprocess.Popen(["dot", "-Tcanon", "-o", os.devnull], + stdin=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + _, stderr = p.communicate(input) + + assert p.returncode != 0, "layout on subgraph was incorrectly accepted" + + assert "layout" in stderr.lower(), "layout not mentioned in error message" + + assert "subgraph" in stderr.lower(), "subgraph not mentioned in error message" + def test_package_version(): """ The graphviz_version.h header should define a non-empty PACKAGE_VERSION