Esempio n. 1
0
 def test_save_file_existing(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     dcfile.set_parm_value("side", "1")
     dcfile.set_parm_value("test2desc", "test2val", "test2comment")
     dcfile.save_file()
     newfile = generic_value_file.GenericValueFile()
     newfile.parse_file(self.filename)
     self.assertEqual(newfile.get_parm_value("side"), "1")
     self.assertEqual(newfile.get_parm_value("test2desc"), "test2val")
     self.assertEqual(newfile.get_parm_comment("test2desc"), "test2comment")
     if os.path.exists("test2file"):
         os.remove("test2file")
Esempio n. 2
0
 def test_set_parm_value_new(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     dcfile.set_parm_value("test1desc", "test1val", "test1comment")
     self.assertEqual(dcfile.get_parm_value("test1desc"), "test1val")
     self.assertEqual(dcfile.get_parm_comment("test1desc"), "test1comment")
Esempio n. 3
0
 def test_set_parm_value_existing(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     comment = dcfile.get_parm_comment("side")
     dcfile.set_parm_value("side", "1")
     self.assertEqual(dcfile.get_parm_value("side"), "1")
     self.assertEqual(dcfile.get_parm_comment("side"), comment)
Esempio n. 4
0
 def test_get_float_value(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     self.assertEqual(dcfile.get_float_value("data(27)"), 10.39565555)
Esempio n. 5
0
 def test_bad_file(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     with self.assertRaises(IOError):
         dcfile.parse_file("./badfile")
Esempio n. 6
0
 def test_bad_parm(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     self.assertEqual(dcfile.get_parm_value("mtnumber"), "")
Esempio n. 7
0
 def test_line_1_token(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     self.assertEqual(dcfile.get_parm_value("DIMC cldfile(9)"), "")
Esempio n. 8
0
 def test_line_2_tokens(self):
     '''test case'''
     dcfile = generic_value_file.GenericValueFile()
     dcfile.parse_file(self.filename)
     self.assertEqual(dcfile.get_parm_value("mtnum"), "50")