test_read_dict_keys.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import pytest
  2. @pytest.mark.usefixtures("state")
  3. def test_read_dict_keys_no_exists(state):
  4. assert state.read_dict_keys(100000) is None
  5. @pytest.mark.usefixtures("state")
  6. def test_read_dict_keys_simple(state):
  7. a = state.create_node()
  8. b = state.create_node()
  9. c = state.create_nodevalue("f")
  10. d = state.create_edge(a, b)
  11. e = state.create_edge(d, c)
  12. assert a is not None
  13. assert b is not None
  14. assert c is not None
  15. assert d is not None
  16. assert e is not None
  17. l = state.read_dict_keys(a)
  18. assert l is not None
  19. assert set(l) == set([c])
  20. @pytest.mark.usefixtures("state")
  21. def test_read_dict_keys_multi(state):
  22. a = state.create_node()
  23. b = state.create_node()
  24. c = state.create_nodevalue("f")
  25. d = state.create_edge(a, b)
  26. e = state.create_edge(d, c)
  27. assert a is not None
  28. assert b is not None
  29. assert c is not None
  30. assert d is not None
  31. assert e is not None
  32. g = state.create_node()
  33. h = state.create_nodevalue("k")
  34. i = state.create_edge(a, g)
  35. j = state.create_edge(i, h)
  36. assert g is not None
  37. assert h is not None
  38. assert i is not None
  39. assert j is not None
  40. l = state.read_dict_keys(a)
  41. assert l is not None
  42. assert set(l) == set([c, h])