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