aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-04-30 12:38:05 +0200
committerCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-04-30 12:38:05 +0200
commitc29a29bb42f0a9da66abdb7b117dfd903716f518 (patch)
treee7246d4a625e8a587a33ef40f572e24e98cfed59 /dotviewer
parentdon't show edges with style=invis (diff)
downloadpypy-c29a29bb42f0a9da66abdb7b117dfd903716f518.tar.gz
pypy-c29a29bb42f0a9da66abdb7b117dfd903716f518.tar.bz2
pypy-c29a29bb42f0a9da66abdb7b117dfd903716f518.zip
add a test for records
Diffstat (limited to 'dotviewer')
-rw-r--r--dotviewer/test/test_record.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/dotviewer/test/test_record.py b/dotviewer/test/test_record.py
new file mode 100644
index 0000000000..7ae62419e4
--- /dev/null
+++ b/dotviewer/test/test_record.py
@@ -0,0 +1,26 @@
+import py
+from dotviewer.drawgraph import TextSnippetRecordLR, record_to_nested_lists
+from dotviewer.conftest import option
+
+def test_split_record():
+ s = "a|{b|c|d|e}|{f|{g|h}|{i|j}|k|l}"
+ l = record_to_nested_lists(s)
+ assert l == ['a', ['b', 'c', 'd', 'e'], ['f', ['g', 'h'], ['i', 'j'], 'k', 'l']]
+ s = "{An Mrecord|has rounded|corners}"
+ l = record_to_nested_lists(s)
+ s = "a|b|c"
+ l = record_to_nested_lists(s)
+ assert l == s.split("|")
+
+def test_ignore_angular():
+ s = "a|{<portname>b|c|d|e}|{f|{g|h}|{i|j}|k|l}"
+ l = record_to_nested_lists(s)
+ assert l == ['a', ['b', 'c', 'd', 'e'], ['f', ['g', 'h'], ['i', 'j'], 'k', 'l']]
+
+def test_show():
+ if not option.pygame:
+ py.test.skip("--pygame not enabled")
+ from dotviewer.drawgraph import GraphLayout
+ layout = GraphLayout(1, 2.0972, 0.97222)
+ layout.add_node('rec', 1.0486, 0.48611, 2.0972, 0.97222, "{a|b|c}|d|e|f|{{g|h}|i}", 'solid', 'record', 'black', 'lightgrey')
+ layout.display()