code: def test_memoize():
      class Counter(object):
          @staticmethod
          def inc():
              Counter._qty = getattr(Counter, "_qty", 0) + 1
              return Counter._qty
  
      @func.memoize()
      def t1(a):
          return a, Counter.inc()
  
      @func.memoize()
      def t2(a):
          return a, Counter.inc()
  
      @func.memoize()
      def t3(a):
          return a, Counter.inc()
  
      @func.memoize()
      def t4(a):
          return a, Counter.inc()
  
      @func.memoize()
      def t5(a, b, c):
          return a + b + c, Counter.inc()
  
      @func.memoize()
      def t6():
          return Counter.inc()
  
      @func.memoize(limit=2)
      def t7(a, _b):
          return a, Counter.inc()
  
      assert (1, 1) == t1(1)
      assert (1, 1) == t1(1)
      assert (2, 2) == t1(2)
      assert (2, 2) == t1(2)
  
      assert (1, 3) == t2(1)
      assert (1, 3) == t2(1)
      assert (2, 4) == t2(2)
      assert (2, 4) == t2(2)
  
      assert (1, 5) == t3(1)
      assert (1, 5) == t3(1)
      assert (2, 6) == t3(2)
      assert (2, 6) == t3(2)
  
      assert (1, 7) == t4(1)
      assert (1, 7) == t4(1)
      assert (2, 8) == t4(2)
      assert (2, 8) == t4(2)
  
      assert (6, 9) == t5(1, 2, 3)
      assert (6, 9) == t5(1, 2, 3)
      assert (7, 10) == t5(1, 2, 4)
      assert (7, 10) == t5(1, 2, 4)
  
      assert 11 == t6()
      assert 11 == t6()
  
      assert (1, 12) == t7(1, None)
      assert (2, 13) == t7(2, None)
      assert (1, 12) == t7(1, None)
      assert (2, 13) == t7(2, None)
      # removed result for (1, None)
      assert (3, 14) == t7(3, None)
      assert (1, 15) == t7(1, None)
  
      class ClassWithMemoizedMethod(object):
          def __init__(self):
              self.a = 0
  
          @func.memoize(True)
          def t(self, i):
              self.a += i
              return i
  
      obj = ClassWithMemoizedMethod()
      assert 10 == obj.t(10)
      assert 10 == obj.a
      assert 10 == obj.t(10)
      assert 10 == obj.a
  
      assert 20 == obj.t(20)
      assert 30 == obj.a
      assert 20 == obj.t(20)
      assert 30 == obj.a
  
file_path: catboost/library/python/func/ut/test_func.py
imports: import pytest
  import multiprocessing
  import random
  import threading
  import time
  import library.python.func
label_desc: Use image node_id 3 for calling a global function with example usage: test_memoize() and returns: a,  Counter, a,  Counter, a,  Counter, a,  Counter, unknown,  Counter, Counter, a,  Counter, Counter, i