/usr/lib/python2.7/dist-packages/pygraphviz/tests/test_subgraph.py is in python-pygraphviz 1.4~rc1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv
from os import linesep
def test_subgraph():
G = pgv.AGraph()
G.add_edge(1,2)
s = G.add_subgraph((1,2),label='foo')
assert_equal(G.string().expandtabs(2),
"""strict graph {
{
graph [label=foo];
1 -- 2;
}
}
""".replace('\n', linesep))
def test_subgraph_cluster():
G = pgv.AGraph(label='foo')
s = G.subgraph('cluster_a', label='<Hello<BR/>World>')
s.add_node('sa')
G.add_node('a')
assert_equal(G.string().expandtabs(2),
"""strict graph {
graph [label=foo];
{
graph [label=<Hello<BR/>World>];
sa;
}
a;
}
""".replace('\n', linesep))
def test_subgraph_cluster_attribute():
G = pgv.AGraph()
s = G.subgraph(name='cluster_a')
s.node_attr['foo']='bar'
G.add_node('a')
G.node_attr['foo']='baz'
assert_equal(G.string().expandtabs(2),
"""strict graph {
node [foo=baz];
subgraph cluster_a {
graph [foo=bar];
}
a;
}
""".replace('\n', linesep))
|