code: def test_ngram_with_regex_fields(dataset_num_files_1, reader_factory):
      """Tests to verify fields and timestamp field can be regular expressions and work with a reader"""
      fields = {
          -1: ["^id.*$", "sensor_name", TestSchema.partition_key],
          0: ["^id.*$", "sensor_name", TestSchema.partition_key],
          1: ["^id.*$", "sensor_name", TestSchema.partition_key],
      }
  
      ts_field = "^id$"
  
      expected_fields = [
          TestSchema.id,
          TestSchema.id2,
          TestSchema.id_float,
          TestSchema.id_odd,
          TestSchema.sensor_name,
          TestSchema.partition_key,
      ]
  
      ngram = _test_continuous_ngram_returns(
          fields, ts_field, dataset_num_files_1, reader_factory
      )
  
      # fields should get resolved after call to a reader
      ngram_fields = ngram.fields
  
      # Can't do direct set equality between expected fields and ngram.fields b/c of issue
      # with `Collections.UnischemaField` (see unischema.py for more information). __hash__
      # and __eq__ is implemented correctly for UnischemaField. However, a collections.UnischemaField
      # object will not use the __hash__ definied in `petastorm.unischema.py`
      for k in ngram_fields.keys():
          assert len(expected_fields) == len(ngram_fields[k])
  
          for curr_field in expected_fields:
              assert curr_field in ngram_fields[k]
  
      assert TestSchema.id == ngram._timestamp_field
  
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 30 for calling a global function with example usage: test_ngram_with_regex_fields(dataset_num_files_1, reader_factory) without return types