code: def test_cycle_iterator_function(self):
      global cycle_iterator_function_calls
      cycle_iterator_function_calls = 0
  
      def one_and_two():
          global cycle_iterator_function_calls
          cycle_iterator_function_calls += 1
          for i in [1, 2]:
              yield i
  
      iterator = iter(util.cycle_iterator_function(one_and_two))
  
      # Function calls should be lazy.
      assert cycle_iterator_function_calls == 0
  
      values = [next(iterator) for _ in range(5)]
      assert values == [1, 2, 1, 2, 1]
      # This is the difference between cycle_iterator_function and itertools.cycle.  We'd only see
      # 1 here with itertools.cycle.
      assert cycle_iterator_function_calls == 3
  
imports: from datetime import timedelta
  import sys
  from collections import OrderedDict
  import pytest
  import torch
  from allennlp.common import util
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.common.util import push_python_path
label_desc: Use image node_id 9 for calling the TestCommonUtils obj's underlying member method code with example usage: obj.test_cycle_iterator_function() without return types