diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:48:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:48:59 +0000 |
commit | d835b2cae8abc71958b69362162e6a70c3d7ef63 (patch) | |
tree | 81052e3d2ce3e1bcda085f73d925e9d6257dec15 /test/unittests/test_gv.py | |
parent | Initial commit. (diff) | |
download | crmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.tar.xz crmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.zip |
Adding upstream version 4.6.0.upstream/4.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/unittests/test_gv.py')
-rw-r--r-- | test/unittests/test_gv.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unittests/test_gv.py b/test/unittests/test_gv.py new file mode 100644 index 0000000..fda7272 --- /dev/null +++ b/test/unittests/test_gv.py @@ -0,0 +1,36 @@ +from __future__ import unicode_literals +# Copyright (C) 2015 Kristoffer Gronlund <kgronlund@suse.com> +# See COPYING for license information. + + +import re + +from crmsh import crm_gv +from crmsh import cibconfig + + +def test_digits_ident(): + g = crm_gv.gv_types["dot"]() + cibconfig.set_graph_attrs(g, ".") + + g.new_node("1a", top_node=True) + g.new_attr("1a", 'label', "1a") + g.new_node("a", top_node=True) + g.new_attr("a", 'label', "a") + + expected = [ + 'fontname="Helvetica";', + 'fontsize="11";', + 'compound="true";', + '"1a" [label="1a"];', + 'a [label="a"];', + ] + out = '\n'.join(g.repr()).replace('\t', '') + + for line in re.match( + r'^digraph G {\n\n(?P<expected>.*)\n}$', out, re.M | re.S + ).group('expected').split('\n'): + assert line in expected + expected.remove(line) + + assert len(expected) == 0 |