test_coord.py 465 B

1234567891011121314151617181920
  1. import pickle
  2. from Jt import Coordinate
  3. import os
  4. def test_save_and_load():
  5. coord_list = os.listdir("coord")
  6. if "testCoord.crd" in coord_list:
  7. print("Removing existing test file...")
  8. os.remove("coord/testCoord.crd")
  9. c = Coordinate()
  10. c.name = "testCoord"
  11. c.save_coord()
  12. with open("coord/" + c.name + ".crd", "rb") as f:
  13. cc = pickle.load(f)
  14. # os.remove("coord/testCoord.crd")
  15. assert cc.name == "testCoord"