def setUp(self): self.obj = dict( a=[ 1,2,3 ]) self.tracker = Mock() self.iobj = instrument(self.obj, self.tracker) self.obj1 = deinstrument(self.iobj) self.list = [ 1,2,3 ] self.ilist = instrument(self.list, self.tracker) self.list1 = deinstrument(self.ilist) class Child(InstrumentedObj): attr = 5 self.Child = Child
def test_instrument(self): self.assertNotEqual(type(self.iobj), dict) self.assertNotEqual(type(self.iobj['a']), list) self.assertNotEqual(type(self.ilist), list) self.assertEqual(type(self.obj1), dict) self.assertEqual(type(self.obj1['a']), list) self.assertEqual(type(self.list1), list) self.assertEqual(self.list1, deinstrument(self.ilist))