123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- import pytest
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_node_none(state):
- b = state.create_node()
- assert b is not None
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_node_one(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_node_multi(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(a, b)
- e = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- assert e is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c, d, e])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_node_multi_others_unaffected(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(a, b)
- e = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- assert e is not None
- f = state.create_node()
- assert f is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c, d, e])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- l = state.read_outgoing(f)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_edge_none(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- l = state.read_outgoing(c)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_edge_one(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(c, a)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- l = state.read_outgoing(c)
- assert l is not None
- assert set(l) == set([d])
- l = state.read_outgoing(d)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_edge_multi(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(c, a)
- e = state.create_edge(c, b)
- f = state.create_edge(c, d)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- assert e is not None
- assert f is not None
- l = state.read_outgoing(c)
- assert l is not None
- assert set(l) == set([d, e, f])
- l = state.read_outgoing(d)
- assert l is not None
- assert set(l) == set([])
- l = state.read_outgoing(e)
- assert l is not None
- assert set(l) == set([])
- l = state.read_outgoing(f)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_nodevalue_none(state):
- b = state.create_nodevalue(1)
- assert b is not None
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_nodevalue_one(state):
- a = state.create_nodevalue(1)
- b = state.create_node()
- c = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_nodevalue_multi(state):
- a = state.create_nodevalue(1)
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(a, b)
- e = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- assert e is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c, d, e])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_nodevalue_multi_others_unaffected(state):
- a = state.create_nodevalue(1)
- b = state.create_node()
- c = state.create_edge(a, b)
- d = state.create_edge(a, b)
- e = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- assert d is not None
- assert e is not None
- f = state.create_nodevalue(1)
- assert f is not None
- l = state.read_outgoing(a)
- assert l is not None
- assert set(l) == set([c, d, e])
- l = state.read_outgoing(b)
- assert l is not None
- assert set(l) == set([])
- l = state.read_outgoing(f)
- assert l is not None
- assert set(l) == set([])
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_node_deleted(state):
- b = state.create_node()
- assert b is not None
- n = state.delete_node(b)
- assert n is None
- l = state.read_outgoing(b)
- assert l is None
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_nodevalue_deleted(state):
- b = state.create_nodevalue(1)
- assert b is not None
- n = state.delete_node(b)
- assert n is None
- l = state.read_outgoing(b)
- assert l is None
- @pytest.mark.usefixtures("state")
- def test_read_outgoing_edge_deleted(state):
- a = state.create_node()
- b = state.create_node()
- c = state.create_edge(a, b)
- assert a is not None
- assert b is not None
- assert c is not None
- n = state.delete_edge(c)
- assert n is None
- l = state.read_outgoing(c)
- assert l is None
|