Anonymous committed c7c4a92

Copy should allow you to update the construction variables.

Comments (0)

Files changed (2)


 	(like a function).  There are no references to any mutable
 	objects in the original Environment.
-	return copy.deepcopy(self)
+	clone = copy.deepcopy(self)
+	apply(clone.Update, (), kw)
+	return clone
     def Scanners(self):
 	pass	# XXX


 	Update the copy independently afterwards and check that
 	the original remains intact (that is, no dangling
 	references point to objects in the copied environment).
+	Copy the original with some construction variable
+	updates and check that the original remains intact
+	and the copy has the updated values.
 	env1 = Environment(XXX = 'x', YYY = 'y')
 	env2 = env1.Copy()
 	assert env1 != env2
 	assert env1 == env1copy
+	env3 = env1.Copy(XXX = 'x3', ZZZ = 'z3')
+	assert env3.Dictionary['XXX'] == 'x3'
+	assert env3.Dictionary['YYY'] == 'y'
+	assert env3.Dictionary['ZZZ'] == 'z3'
+	assert env1 == env1copy
     def test_Dictionary(self):
 	"""Test the simple ability to retrieve known construction
 	variables from the Dictionary and check for well-known