Пример #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))
Пример #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))
Пример #3
0
 def testReduce(self):
     self.assertEqual(45, pycfunc.reduce(lambda x, y: x + y, xrange(10)))
Пример #4
0
 def testReduce(self):
   self.assertEqual(45, pycfunc.reduce(lambda x, y: x + y, xrange(10)))