Ticket #18175: sorted_dict_copy.diff
File sorted_dict_copy.diff, 1.1 KB (added by , 13 years ago) |
---|
-
django/utils/datastructures.py
128 128 return self.__class__([(key, copy.deepcopy(value, memo)) 129 129 for key, value in self.iteritems()]) 130 130 131 def __copy__(self): 132 return self.copy() 133 131 134 def __setitem__(self, key, value): 132 135 if key not in self: 133 136 self.keyOrder.append(key) -
tests/regressiontests/utils/datastructures.py
111 111 {7: 'seven', 1: 'one', 9: 'nine'} 112 112 ) 113 113 114 def test_copy(self): 115 d = SortedDict(((1, "one"), (0, "zero"), (2, "two"))) 116 copy.copy(d) 117 self.assertEqual( 118 d.keys(), 119 [1, 0, 2] 120 ) 121 114 122 def test_clear(self): 115 123 self.d1.clear() 116 124 self.assertEqual(self.d1, {})