Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

test_json.py 518B

il y a 6 ans
12345678910111213141516171819202122232425262728293031
  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