Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / networkx / utils / tests / test_contextmanager.py @ 5cef0f13

History | View | Annotate | Download (388 Bytes)

1
from __future__ import absolute_import
2

    
3
from nose.tools import *
4

    
5
import networkx as nx
6

    
7

    
8
def test_reversed():
9
    G = nx.DiGraph()
10
    G.add_edge('A', 'B')
11

    
12
    # no exception
13
    with nx.utils.reversed(G):
14
        pass
15
    assert_true('B' in G['A'])
16

    
17
    # exception
18
    try:
19
        with nx.utils.reversed(G):
20
            raise Exception
21
    except:
22
        assert_true('B' in G['A'])