code: def test_with_dataset_repeat(synthetic_dataset, reader_factory):
      """``tf.data.Dataset``'s ``repeat`` is not recommended to used on ``make_petastorm_dataset`` due to high costs of
      ``Reader initialization``. A user should use ``Reader`` built-in epochs support, or use
      ``tf.data.Dataset``'s ``cache``. Check that we trigger a warning to alert of misuse.
      """
      with reader_factory(synthetic_dataset.url) as reader:
          dataset = make_petastorm_dataset(reader)
  
          dataset = dataset.repeat(2)
  
          iterator = dataset.make_one_shot_iterator()
  
          # Read a bunch of entries from the dataset and compare the data to reference
          with tf.Session() as sess:
              iterator = iterator.get_next()
  
              for _, _ in enumerate(synthetic_dataset.data):
                  sess.run(iterator)
  
              match_str = "Running multiple iterations over make_petastorm_dataset is not recommend for performance issue"
              with pytest.warns(UserWarning, match=match_str):
                  sess.run(iterator)
  
file_path: petastorm/petastorm/tests/test_tf_dataset.py
imports: import functools
  import operator
  from copy import copy
  import numpy
  import pytest
  import tensorflow.compat.v1
  from petastorm import make_reader, make_batch_reader
  from petastorm.ngram import NGram
  from petastorm.predicates import in_lambda
  from petastorm.tests.test_common import TestSchema
  from petastorm.tests.test_tf_utils import create_tf_graph
  from petastorm.tf_utils import make_petastorm_dataset
label_desc: Use image node_id 3 for calling a global function with example usage: test_with_dataset_repeat(synthetic_dataset, reader_factory) without return types