Anders and Briegel in Python
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

33 行
555B

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