Beispiel #1
0
 def test_it_returns_a_copy_of_each_item(self):
   items = [
     {"numbers" : [1, 2, 3]},
     {"I'm" : "awesome", "how" : "are you?"},
     ["bob", "dole"]
   ]
   
   retval = clone_each(items)
   for r in retval:
     # Values are the same
     self.assertTrue(r in items)
     
     # But the id's are different
     original_item = items[items.index(r)]
     self.assertNotEqual(id(r), id(original_item))
Beispiel #2
0
 def test_it_returns_an_iterator(self):
   result = clone_each([1, 2, 3])
   self.assertTrue(isinstance(result, Iterator))