File: test_contextmanager.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 (21 lines) | stat: -rw-r--r-- 387 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
from __future__ import absolute_import

from nose.tools import *

import networkx as nx

def test_reversed():
    G = nx.DiGraph()
    G.add_edge('A', 'B')

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

    # exception
    try:
        with nx.utils.reversed(G):
            raise Exception
    except:
        assert_true('B' in G['A'])