Beispiel #1
0
 def testReduceReferenceCount(self):
     func = lambda x, y: None
     x = object()
     y = object()
     l = [x, y]
     rc_func = sys.getrefcount(func)
     rc_x = sys.getrefcount(x)
     rc_y = sys.getrefcount(y)
     pycfunc.reduce(func, l)
     self.assertEqual(rc_func, sys.getrefcount(func))
     self.assertEqual(rc_x, sys.getrefcount(x))
     self.assertEqual(rc_y, sys.getrefcount(y))
Beispiel #2
0
 def testReduceReferenceCount(self):
   func = lambda x, y: None
   x = object()
   y = object()
   l = [x, y]
   rc_func = sys.getrefcount(func)
   rc_x = sys.getrefcount(x)
   rc_y = sys.getrefcount(y)
   pycfunc.reduce(func, l)
   self.assertEqual(rc_func, sys.getrefcount(func))
   self.assertEqual(rc_x, sys.getrefcount(x))
   self.assertEqual(rc_y, sys.getrefcount(y))
Beispiel #3
0
 def testReduce(self):
     self.assertEqual(45, pycfunc.reduce(lambda x, y: x + y, xrange(10)))
Beispiel #4
0
 def testReduce(self):
   self.assertEqual(45, pycfunc.reduce(lambda x, y: x + y, xrange(10)))