code: def _test_continuous_ngram(
      ngram_fields, dataset_num_files_1, reader_factory
  ):
      """Test continuous ngram of a certain length. Continuous here refers to
      that this reader will always return consecutive ngrams due to shuffle being false
      and partition being 1."""
  
      ngram = NGram(
          fields=ngram_fields,
          delta_threshold=10,
          timestamp_field=TestSchema.id,
      )
      with reader_factory(
          dataset_num_files_1.url,
          schema_fields=ngram,
          shuffle_row_groups=False,
      ) as reader:
          expected_id = 0
  
          for _ in range(ngram.length):
              actual = next(reader)
              expected_ngram = _get_named_tuple_from_ngram(
                  ngram, dataset_num_files_1.data, expected_id
              )
              np.testing.assert_equal(actual, expected_ngram)
              expected_id = expected_id + 1
  
imports: from decimal import Decimal
  import numpy
  import pytest
  import tensorflow.compat.v1
  from unittest import mock
  from petastorm import make_reader
  from petastorm.ngram import NGram
  from petastorm.tests.conftest import SyntheticDataset, maybe_cached_dataset
  from petastorm.tests.test_common import create_test_dataset, TestSchema
  from petastorm.tests.test_tf_utils import create_tf_graph
  from petastorm.tf_utils import tf_tensors
label_desc: Use image node_id 7 for calling a global function with example usage: _test_continuous_ngram(ngram_fields, dataset_num_files_1, reader_factory) without return types