Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031
  1. import mock
  2. import abp
  3. def test_json():
  4. """ Test to_json and from_json """
  5. a = mock.named_node_graph()
  6. j = a.to_json()
  7. b = abp.GraphState()
  8. b.from_json(j)
  9. assert a == b
  10. def test_json_again():
  11. """ Test to_json and from_json """
  12. # Make a random graph
  13. a = abp.GraphState(10)
  14. a.act_circuit(mock.random_graph_circuit())
  15. # Dump it to JSON
  16. j = a.to_json()
  17. # Reconstruct from JSON
  18. b = abp.GraphState()
  19. b.from_json(j)
  20. # Check equality
  21. assert a == b