test_read_dict_node.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import pytest
  2. @pytest.mark.usefixtures("state")
  3. def test_read_dict_node_no_exists(state):
  4. assert state.read_dict_node(-1, "abc") is None
  5. @pytest.mark.usefixtures("state")
  6. def test_read_dict_node_not_found_edge(state):
  7. a = state.create_node()
  8. b = state.create_node()
  9. c = state.create_edge(a, b)
  10. assert a is not None
  11. assert b is not None
  12. assert c is not None
  13. # Passing data is not enforced, as the data will be interpreted if necessary
  14. assert state.read_dict_node(c, "abc") is None
  15. @pytest.mark.usefixtures("state")
  16. def test_read_dict_node_no_primitive(state):
  17. a = state.create_node()
  18. assert a is not None
  19. # Passing data is not enforced, as the data will be interpreted if necessary
  20. assert state.read_dict_node(a, a) is None
  21. @pytest.mark.usefixtures("state")
  22. def test_read_dict_node_node_simple(state):
  23. a = state.create_node()
  24. b = state.create_node()
  25. c = state.create_node()
  26. d = state.create_edge(a, b)
  27. e = state.create_edge(d, c)
  28. assert a is not None
  29. assert b is not None
  30. assert c is not None
  31. assert d is not None
  32. assert e is not None
  33. l = state.read_dict_node(a, c)
  34. assert l == b
  35. @pytest.mark.usefixtures("state")
  36. def test_read_dict_node_multi(state):
  37. a = state.create_node()
  38. b = state.create_node()
  39. c = state.create_node()
  40. d = state.create_edge(a, b)
  41. e = state.create_edge(d, c)
  42. assert a is not None
  43. assert b is not None
  44. assert c is not None
  45. assert d is not None
  46. assert e is not None
  47. g = state.create_node()
  48. h = state.create_node()
  49. i = state.create_edge(a, g)
  50. j = state.create_edge(i, h)
  51. assert g is not None
  52. assert h is not None
  53. assert i is not None
  54. assert j is not None
  55. l = state.read_dict_node(a, c)
  56. assert l == b
  57. l = state.read_dict_node(a, h)
  58. assert l == g