File: test_directed.py

package info (click to toggle)
python-networkx 1.9%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,052 kB
  • ctags: 3,986
  • sloc: python: 52,132; makefile: 176
file content (36 lines) | stat: -rw-r--r-- 1,313 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env python

"""Generators - Directed Graphs
----------------------------
"""

from nose.tools import *
from networkx import *
from networkx.generators.directed import *

class TestGeneratorsDirected():
    def test_smoke_test_random_graphs(self):
        G=gn_graph(100)
        G=gnr_graph(100,0.5)
        G=gnc_graph(100)
        G=scale_free_graph(100)

    def test_create_using_keyword_arguments(self):
        assert_raises(networkx.exception.NetworkXError,
                      gn_graph, 100, create_using=Graph())
        assert_raises(networkx.exception.NetworkXError,
                      gnr_graph, 100, 0.5, create_using=Graph())
        assert_raises(networkx.exception.NetworkXError,
                      gnc_graph, 100, create_using=Graph())
        assert_raises(networkx.exception.NetworkXError,
                      scale_free_graph, 100, create_using=Graph())
        G=gn_graph(100,seed=1)
        MG=gn_graph(100,create_using=MultiDiGraph(),seed=1)
        assert_equal(G.edges(), MG.edges())
        G=gnr_graph(100,0.5,seed=1)
        MG=gnr_graph(100,0.5,create_using=MultiDiGraph(),seed=1)
        assert_equal(G.edges(), MG.edges())
        G=gnc_graph(100,seed=1)
        MG=gnc_graph(100,create_using=MultiDiGraph(),seed=1)
        assert_equal(G.edges(), MG.edges())