Esempio n. 1
0
 def setUp(self):
     self.save_filepath = os.path.join(current_dir, "save_file_Test1.txt")
     self._pm = pm.PM()
     self._pm.Add("param_1", default=1)
     self._pm.Add("param_2", default=2)
     self._pm.Add("param_3", default=3)
     self._pm.Add("param_4", default=4)
     self._pm.Add("param_5", default=5)
Esempio n. 2
0
 def test3(self):
     self._pm = pm.PM()
     self._pm.Add("param_1", demanding_indicator=pm.PM.DI.NEVER.Key)
     self._pm.Add("param_2", demanding_indicator=pm.PM.DI.NEVER.Key)
     self._pm.Add("param_3", demanding_indicator=pm.PM.DI.NEVER.Key)
     self._pm.Add("param_4", demanding_indicator=pm.PM.DI.NEVER.Key)
     self._pm.Add("param_5", demanding_indicator=pm.PM.DI.NEVER.Key)
     # testing
     self._pm.Check(pm.PM.DI.NEVER.Key)
     self._pm.Check(pm.PM.DI.ORDER_1.Key)
     self._pm.Check(pm.PM.DI.ORDER_2.Key)
     self._pm.Check(pm.PM.DI.ORDER_3.Key)
     self._pm.Check(pm.PM.DI.ORDER_4.Key)
     self._pm.Check(pm.PM.DI.ORDER_5.Key)
     self._pm.Check(pm.PM.DI.ALWAYS.Key)
Esempio n. 3
0
 def test1(self):
     self._pm = pm.PM()
     self._pm.Add("param_1")
     self._pm.Add("param_2")
     # testing
     self.assertRaises(errors.ParameterIsAlreadyExist, self._pm.Add,
                       "param_1")
     self.assertRaises(errors.ParameterIsAlreadyExist, self._pm.Add,
                       "param_2")
     self.assertRaises(errors.ParameterIsNotExist, self._pm.Set, "param_3",
                       3)
     self.assertRaises(errors.ParameterIsNotExist, self._pm.Set, "param_4",
                       4)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self._pm.Set("param_1", 1)
     self._pm.Set("param_2", 2)
     self._pm.Check()
Esempio n. 4
0
 def setUp(self):
     self.save_filepath = os.path.join(current_dir, "save_file_Test2.txt")
     self._pm = pm.PM()
     self._pm.Add("param_1")
     self._pm.Add("param_2")
Esempio n. 5
0
 def test4(self):
     self._pm = pm.PM()
     self._pm.Add("param_1", demanding_indicator=pm.PM.DI.ALWAYS.Key)
     self._pm.Add("param_2", demanding_indicator=pm.PM.DI.ALWAYS.Key)
     self._pm.Add("param_3", demanding_indicator=pm.PM.DI.ALWAYS.Key)
     self._pm.Add("param_4", demanding_indicator=pm.PM.DI.ALWAYS.Key)
     self._pm.Add("param_5", demanding_indicator=pm.PM.DI.ALWAYS.Key)
     # testing
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_5.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_4.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_3.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_2.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_1.Key)
     self._pm.Set("param_1", 1)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_5.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_4.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_3.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_2.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_1.Key)
     self._pm.Set("param_2", 2)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_5.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_4.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_3.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_2.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_1.Key)
     self._pm.Set("param_3", 3)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_5.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_4.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_3.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_2.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_1.Key)
     self._pm.Set("param_4", 4)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_5.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_4.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_3.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_2.Key)
     self.assertRaises(errors.RequiredParameterIsNotInitialized,
                       self._pm.Check, pm.PM.DI.ORDER_1.Key)
     self._pm.Set("param_5", 5)
     self._pm.Check()