Esempio n. 1
0
 def test_from_dict(self):
     io = Control.from_dict(self.test_dict)
     if os.path.exists(os.path.join(test_dir, "test_control")):
         os.remove(os.path.join(test_dir, "test_control"))
     io.to_file(filename=os.path.join(test_dir, "test_control"))
     with open(os.path.join(test_dir, "test_control")) as file:
         test_string = file.read()
     with open(os.path.join(test_dir, "CONTROL-CSLD_Si")) as reference_file:
         reference_string = reference_file.read()
     self.assertMultiLineEqual(test_string, reference_string)
     os.remove(os.path.join(test_dir, "test_control"))
Esempio n. 2
0
 def test_MSONable_implementation(self):
     # tests as dict and from dict methods
     Controlinfromfile = Control.from_file(self.filename)
     newControlin = Control.from_dict(Controlinfromfile.as_dict())
     self.assertDictEqual(newControlin, Controlinfromfile)
     newControlin.to_json()