def test_setAttr_wrongName(self):
		c = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithIntConfiguration")
		try:
			c["WrongParam"] = 24
			self.fail("Exception expected")
		except KeyError, e:
			self.assertEquals("WrongParam", e.args[0])
示例#2
0
 def test_getDefaultValue_whenOtherTypes(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithCompleteConfiguration")
     self.assertEqual(42, engine["IntAttribute"])
     self.assertEqual(False, engine["BoolAttribute"])
     self.assertEqual(3.140000104904175, engine["FloatAttribute"])
     self.assertEqual(134.15, engine["DoubleAttribute"])
	def test_raiseAttributeErrorGettingValueFromWrongAttribute(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		try:
			engine["WrongAttribute"]
			self.fail("Exception expected")
		except KeyError, e:
			self.assertEqual("WrongAttribute", e.args[0])
示例#4
0
 def test_raiseAttributeErrorGettingValueFromWrongAttribute(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     try:
         engine["WrongAttribute"]
         self.fail("Exception expected")
     except KeyError, e:
         self.assertEqual("WrongAttribute", e.args[0])
示例#5
0
 def test_setAttr_wrongName(self):
     c = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithIntConfiguration")
     try:
         c["WrongParam"] = 24
         self.fail("Exception expected")
     except KeyError, e:
         self.assertEquals("WrongParam", e.args[0])
	def test_setValueFromDifferentTypesOfAttributes(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithCompleteConfiguration")
		engine["BoolAttribute"] = True
		engine["FloatAttribute"] = 4.15
		engine["DoubleAttribute"] = 124.78
		self.assertEqual(True, engine["BoolAttribute"])
		self.assertEqual(4.150000095367432, engine["FloatAttribute"])
		self.assertEqual(124.78, engine["DoubleAttribute"])
示例#7
0
 def test_setValueFromDifferentTypesOfAttributes(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithCompleteConfiguration")
     engine["BoolAttribute"] = True
     engine["FloatAttribute"] = 4.15
     engine["DoubleAttribute"] = 124.78
     self.assertEqual(True, engine["BoolAttribute"])
     self.assertEqual(4.150000095367432, engine["FloatAttribute"])
     self.assertEqual(124.78, engine["DoubleAttribute"])
示例#8
0
 def test_set_wrongTypeForFloat(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithCompleteConfiguration")
     try:
         engine["FloatAttribute"] = "Value"
         self.fail("Exception expected")
     except TypeError, e:
         self.assertEquals(
             "While setting parameter 'FloatAttribute', "
             "cannot convert a Python value of type 'str' "
             "into a C++ value of type 'float'.", e.args[0])
示例#9
0
 def test_set_wrongTypeForInt(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithIntConfiguration")
     try:
         engine["FirstInt"] = "WrongType"
         self.fail("Exception expected")
     except TypeError, e:
         self.assertEquals(
             "While setting parameter 'FirstInt', "
             "cannot convert a Python value of type 'str' "
             "into a C++ value of type 'int'.", e.args[0])
示例#10
0
 def test_set_wrongTypeForString(self):
     c = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     try:
         c["AString"] = 2
         self.fail("Exception expected")
     except TypeError, e:
         self.assertEquals(
             "While setting parameter 'AString', "
             "cannot convert a Python value of type 'int' "
             "into a C++ value of type 'string'.", e.args[0])
	def test_set_wrongTypeForBool(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithCompleteConfiguration")
		try:
			engine["BoolAttribute"] = 2.15
			self.fail("Exception expected")
		except TypeError, e:
			self.assertEquals(
				"While setting parameter 'BoolAttribute', "
				"cannot convert a Python value of type 'float' "
				"into a C++ value of type 'bool'."
				, e.args[0])
	def test_set_wrongTypeForInt(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithIntConfiguration")
		try:
			engine["FirstInt"] = "WrongType"
			self.fail("Exception expected")
		except TypeError, e:
			self.assertEquals(
				"While setting parameter 'FirstInt', "
				"cannot convert a Python value of type 'str' "
				"into a C++ value of type 'int'."
				, e.args[0])
	def test_set_wrongTypeForString(self):
		c = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		try:
			c["AString"] = 2
			self.fail("Exception expected")
		except TypeError, e:
			self.assertEquals(
				"While setting parameter 'AString', "
				"cannot convert a Python value of type 'int' "
				"into a C++ value of type 'string'."
				, e.args[0])
	def test_createConfigurationProxy(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		self.assertEqual(
		"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n"
		"<Configuration>\n"
		"\n"
		"  <AString>DefaultValue</AString>\n"
		"\n"
		"  <OtherString>Another default value</OtherString>\n"
		"\n"
		"</Configuration>\n"
		, engine.xml())
示例#15
0
 def test_createConfigurationProxy(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     self.assertEqual(
         "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n"
         "<Configuration>\n"
         "\n"
         "  <AString>DefaultValue</AString>\n"
         "\n"
         "  <OtherString>Another default value</OtherString>\n"
         "\n"
         "</Configuration>\n", engine.xml())
示例#16
0
 def test_setValueFromStringAttributes(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     engine["AString"] = "newvalue"
     self.assertEqual("newvalue", engine["AString"])
	def test_getDefaultValue_whenInt(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithIntConfiguration")
		self.assertEqual(42, engine["FirstInt"])
		self.assertEqual(15, engine["SecondInt"])
示例#18
0
 def test_getDefaultValue_whenInt(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithIntConfiguration")
     self.assertEqual(42, engine["FirstInt"])
     self.assertEqual(15, engine["SecondInt"])
	def test_getDefaultValue_whenOtherTypes(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithCompleteConfiguration")
		self.assertEqual(42, engine["IntAttribute"])
		self.assertEqual(False, engine["BoolAttribute"])
		self.assertEqual(3.140000104904175, engine["FloatAttribute"])
		self.assertEqual(134.15, engine["DoubleAttribute"])
	def test_getValueFromStringAttributes(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		self.assertEqual("DefaultValue", engine["AString"])
		self.assertEqual("Another default value", engine["OtherString"])
示例#21
0
 def test_keys(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     self.assertEqual(["AString", "OtherString"], engine.keys())
	def test_set_optional_attribute(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithOptionalAttributes")
		engine["SecondInt"] = 22
		self.assertEqual(22, engine["SecondInt"])
	def test_setValueFromStringAttributes(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		engine["AString"] = "newvalue"
		self.assertEqual("newvalue", engine["AString"])
示例#24
0
 def test_setValueFromIntegerAttributes(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithIntConfiguration")
     engine["FirstInt"] = 24
     self.assertEqual(24, engine["FirstInt"])
示例#25
0
 def test_set_optional_attribute(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithOptionalAttributes")
     engine["SecondInt"] = 22
     self.assertEqual(22, engine["SecondInt"])
示例#26
0
 def test_set_attribute_as_removed(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithOptionalAttributes")
     engine["FirstInt"] = None
     self.assertEqual(None, engine["FirstInt"])
	def test_set_attribute_as_removed(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithOptionalAttributes")
		engine["FirstInt"] = None
		self.assertEqual(None, engine["FirstInt"])
示例#28
0
 def test_getValueFromStringAttributes(self):
     engine = Clam_ConfigurationProxy.createConfigurationProxy(
         "DummyProcessingWithStringConfiguration")
     self.assertEqual("DefaultValue", engine["AString"])
     self.assertEqual("Another default value", engine["OtherString"])
	def test_keys(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithStringConfiguration")
		self.assertEqual( ["AString", "OtherString"], engine.keys() )
	def test_setValueFromIntegerAttributes(self):
		engine = Clam_ConfigurationProxy.createConfigurationProxy("DummyProcessingWithIntConfiguration")
		engine["FirstInt"] = 24
		self.assertEqual(24, engine["FirstInt"])