コード例 #1
0
    def test_compare_helper_2 (self) :
	"""
	compares 2 identical trees and returns True
	"""
	tag_list = []

	#These are for the main tree
	tag_list.append("<Outer>")
	tag_list.append("<Inner>")
	tag_list.append("</Inner>")
	tag_list.append("</Outer>")

	#these are for the key tree
	tag_list.append("<Outer>")
	tag_list.append("<Inner>")
	tag_list.append("</Inner>")
	tag_list.append("</Outer>")

	tree_list_1B = []

	xml_populate_trees(tag_list, tree_list_1B)

	result = xml_compare_helper(tree_list_1B[0], tree_list_1B[1])
	
	self.assert_(result == True)
コード例 #2
0
    def test_compare_helper_3 (self) :
	"""
	finds a match deep into the tree w/ siblings
	"""
	tag_list = []

	#These are for the main tree
	tag_list.append("<Outer>")
	tag_list.append("<Inner>")
	tag_list.append("<A>")
	tag_list.append("<B>")
	tag_list.append("</B>")
	tag_list.append("<C>")
	tag_list.append("</C>")
	tag_list.append("</A>")
	tag_list.append("</Inner>")
	tag_list.append("</Outer>")

	#these are for the key tree
	tag_list.append("<A>")
	tag_list.append("<C>")
	tag_list.append("<F>")
	tag_list.append("</F>")
	tag_list.append("</C>")
	tag_list.append("</A>")


	tree_list_1C = []

	xml_populate_trees(tag_list, tree_list_1C)

	result = xml_compare_helper(tree_list_1C[0], tree_list_1C[1])
	
	self.assert_(result == False)
コード例 #3
0
    def test_compare_helper_1 (self) :
	"""
	compares 2 different trees and returns False
	"""
	tag_list = []

	#These are for the main tree
	tag_list.append("<Outer>")
	tag_list.append("<Inner>")
	tag_list.append("</Inner>")
	tag_list.append("</Outer>")

	#these are for the key tree
	tag_list.append("<Outer>")
	tag_list.append("<Fatboy>")
	tag_list.append("</Fatboy>")
	tag_list.append("</Outer>")

	tree_list_1A = []

	xml_populate_trees(tag_list, tree_list_1A)

	result = xml_compare_helper(tree_list_1A[0], tree_list_1A[1])
	
	self.assert_(result == False)