This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/networkx/utils/tests/test_contextmanager.py
2020-08-30 12:36:33 +02:00

21 lines
312 B
Python

import networkx as nx
def test_reversed():
G = nx.DiGraph()
G.add_edge('A', 'B')
# no exception
with nx.utils.reversed(G):
pass
assert 'B' in G['A']
# exception
try:
with nx.utils.reversed(G):
raise Exception
except:
assert 'B' in G['A']