Пример #1
0
 def test_save_file_existing(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     dcfile.set_parm_value("side", "1")
     dcfile.set_parm_value("test2desc", "test2val", "test2comment")
     dcfile.save_file()
     newfile = dac_file.DACFile()
     newfile.parse_file(self.bc1_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")
Пример #2
0
 def test_save_file_new(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     dcfile.set_parm_value("side", "1")
     dcfile.set_parm_value("test2desc", "test2val", "test2comment")
     dcfile.save_file("test2file")
     newfile = dac_file.DACFile()
     newfile.parse_file("test2file")
     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")
Пример #3
0
 def test_set_parm_value_new(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     dcfile.set_parm_value("test1desc", "test1val", "test1comment")
     self.assertEqual(dcfile.get_parm_value("test1desc"), "test1val")
     self.assertEqual(dcfile.get_parm_comment("test1desc"), "test1comment")
Пример #4
0
 def test_set_parm_value_existing(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_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)
Пример #5
0
 def test_bad_file(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     with self.assertRaises(IOError):
         dcfile.parse_file("./badfile")
Пример #6
0
 def test_bad_parm(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     self.assertEqual(dcfile.get_parm_value("mtnumber"), "")
Пример #7
0
 def test_line_1_token(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     self.assertEqual(dcfile.get_parm_value("DIMC cldfile(9)"), "")
Пример #8
0
 def test_line_2_tokens(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     self.assertEqual(dcfile.get_parm_value("mtnum"), "50")
Пример #9
0
 def test_line_3_tokens(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc2_filename)
     self.assertEqual(dcfile.get_parm_value("side"), "2")
Пример #10
0
 def test_is_bc_type_3(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.fc_filename)
     self.assertEqual(dcfile.is_bc_type(), False)
Пример #11
0
 def test_is_bc_type_2(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc2_filename)
     self.assertEqual(dcfile.is_bc_type(), True)
Пример #12
0
 def test_get_float_value(self):
     '''test case'''
     dcfile = dac_file.DACFile()
     dcfile.parse_file(self.bc1_filename)
     self.assertEqual(dcfile.get_float_value("data(27)"), 10.39565555)