Esempio n. 1
0
def test_nx1_convert_warn(nodelink_json):
    # with pytest.warns(UserWarning):  # this assertion fails even though the warning is raised!
    d = convert_nodelink_data(nodelink_json)

    with pytest.raises(Exception):
        json_graph.node_link_graph(d)
Esempio n. 2
0
def test_nx2_convert_nowarn(nodelink_json, expected_graph):
    with pytest.warns(None) as record:
        d = convert_nodelink_data(nodelink_json)
    assert len(record) == 0
    assert_same_graph(json_graph.node_link_graph(d), expected_graph)
Esempio n. 3
0
def test_converts():
    v1, v2 = [get_json(v) for v in ['1-11', '2-2']]
    assert convert_nodelink_data(v1) == v2
Esempio n. 4
0
def test_fails_to_convert():
    v2 = get_json("2-2")
    with pytest.raises(RuntimeError):
        convert_nodelink_data(v2)
Esempio n. 5
0
def test_converts():
    v1, v2 = [get_json(v) for v in ["1-11", "2-2"]]
    assert convert_nodelink_data(v1) == v2