File: test_html.py

package info (click to toggle)
python-pygraphviz 1.3.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 664 kB
  • sloc: ansic: 4,970; python: 2,523; makefile: 152
file content (23 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv
from os import linesep

def test_html():
    G = pgv.AGraph(label='<Hello<BR/>Graph>')
    G.add_node('a', label='<Hello<BR/>Node>')
    s = G.add_subgraph('b', label='<Hello<BR/>Subgraph>')
    s.add_node('sa', label='<Hello<BR/>Subgraph Node b>')
    G.add_edge('a','b', label='<Hello<BR/>Edge>')
    assert_equal(G.string().expandtabs(2),
"""strict graph {
  graph [label=<Hello<BR/>Graph>];
  node [label="\\N"];
  {
    graph [label=<Hello<BR/>Subgraph>];
    sa     [label=<Hello<BR/>Subgraph Node b>];
  }
  a  [label=<Hello<BR/>Node>];
  a -- b   [label=<Hello<BR/>Edge>];
}
""".replace('\n', linesep))