<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/testing/__init__.py) |

Testing utilities.

## Classes

[`class DatasetBuilderTestCase`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DatasetBuilderTestCase): Inherit this class to test your DatasetBuilder class.

[`class DummyBeamDataset`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyBeamDataset): Minimal beam DatasetBuilder.

[`class DummyDataset`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyDataset): Minimal DatasetBuilder.

[`class DummyDatasetCollection`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyDatasetCollection): Minimal Dataset Collection builder.

[`class DummyDatasetSharedGenerator`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyDatasetSharedGenerator): Test DatasetBuilder.

[`class DummyMnist`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyMnist): Test DatasetBuilder.

[`class DummyParser`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummyParser): To mock example_parser.ExampleParser.

[`class DummySerializer`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/DummySerializer): To mock example_serializer.ExampleSerializer.

[`class FeatureExpectationItem`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/FeatureExpectationItem): Test item of a FeatureExpectation.

[`class FeatureExpectationsTestCase`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/FeatureExpectationsTestCase): Tests FeatureExpectations with full encode-decode.

[`class MockFs`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/MockFs): This util wraps mock for the [`tf.io.gfile`](https://www.tensorflow.org/api_docs/python/tf/io/gfile) / `epath.Path` API.

[`class MockPolicy`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/MockPolicy): Strategy to use with [`tfds.testing.mock_data`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/mock_data) to mock the dataset.

[`class PickableDataSourceMock`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/PickableDataSourceMock): Makes MagicMock pickable in order to work with multiprocessing in Grain.

[`class RaggedConstant`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/RaggedConstant): Container of tf.ragged.constant values.

[`class SubTestCase`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/SubTestCase): Adds subTest() context manager to the TestCase if supported.

[`class TestCase`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/TestCase): Base TestCase to be used for all tests.

[`class TestCaseInContext`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/TestCaseInContext): Base TestCase for running tests inside the given contexts.

[`class TestValue`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/TestValue): Expresses None values in test without writing the Python None.

## Functions

[`assert_features_equal(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/assert_features_equal): Asserts that the 2 nested FeatureConnector structure match.

[`disable_gcs_access(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/disable_gcs_access): Disable GCS access.

[`dummy_croissant_file(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/dummy_croissant_file): Yields temporary path to a dummy Croissant file.

[`enable_gcs_access(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/enable_gcs_access): Enable GCS access.

[`fake_examples_dir(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/fake_examples_dir)

[`make_tmp_dir(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/make_tmp_dir): Make a temporary directory.

[`mock_data(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/mock_data): Mock tfds to generate random data.

[`mock_default_data_dir(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/mock_default_data_dir): Mocks the `constants.DATA_DIR`.

[`mock_kaggle_api(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/mock_kaggle_api): Mock out the kaggle CLI.

[`rm_tmp_dir(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/rm_tmp_dir): Rm temporary directory.

[`run_in_graph_and_eager_modes(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/run_in_graph_and_eager_modes): Execute the decorated test in both graph mode and eager mode.

[`set_current_datetime(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/set_current_datetime): Mocks datetime.datetime.now().

[`test_main(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/test_main): Entrypoint for tests.

[`tmp_dir(...)`](https://www.tensorflow.org/datasets/api_docs/python/tfds/testing/tmp_dir): Context manager for a temporary directory.