Anders and Briegel in Python
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

32 行
518B

  1. import abp
  2. import mock
  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