Exemplo n.º 1
0
	def testHasAttribute(self):
		"""
		Tests :meth:`foundations.nodes.AbstractNode.attributeExists` method.
		"""

		attributes = {"attributeA" : Attribute(), "attributeB" : Attribute()}

		nodeA = AbstractNode("MyNodeA", **attributes)
		for attribute in attributes:
			self.assertTrue(nodeA.attributeExists(attribute))
		nodeB = AbstractNode("MyNodeB", nonAttribute="Non Attribute")
		self.assertFalse(nodeB.attributeExists("nonAttribute"))
Exemplo n.º 2
0
	def testAddAttribute(self):
		"""
		Tests :meth:`foundations.nodes.AbstractNode.addAttribute` method.
		"""

		attributes = {"attributeA" : Attribute(), "attributeB" : Attribute()}

		nodeA = AbstractNode("MyNodeA")
		for attribute, value in attributes.iteritems():
			self.assertTrue(nodeA.addAttribute(attribute, value))
			self.assertTrue(nodeA.attributeExists(attribute))