Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / algorithms / community / tests / test_utils.py @ 5cef0f13

History | View | Annotate | Download (756 Bytes)

1
# test_utils.py - unit tests for the community utils module
2
#
3
# Copyright 2016 NetworkX developers.
4
#
5
# This file is part of NetworkX.
6
#
7
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
8
# information.
9
"""Unit tests for the :mod:`networkx.algorithms.community.utils` module.
10

11
"""
12
from nose.tools import assert_false
13
from nose.tools import assert_true
14

    
15
import networkx as nx
16
from networkx.algorithms.community import is_partition
17

    
18

    
19
def test_is_partition():
20
    G = nx.empty_graph(3)
21
    assert_true(is_partition(G, [{0, 1}, {2}]))
22

    
23

    
24
def test_not_covering():
25
    G = nx.empty_graph(3)
26
    assert_false(is_partition(G, [{0}, {1}]))
27

    
28

    
29
def test_not_disjoint():
30
    G = nx.empty_graph(3)
31
    assert_false(is_partition(G, [{0, 1}, {1, 2}]))