|
27 | 27 | from absl.testing import absltest
|
28 | 28 | from absl.testing import parameterized
|
29 | 29 | import numpy as np
|
30 |
| -import six |
31 | 30 | import tensorflow as tf
|
32 | 31 |
|
33 | 32 | from tensorflow_datasets.core import dataset_builder
|
@@ -70,28 +69,31 @@ class DatasetBuilderTestCase(parameterized.TestCase, test_utils.SubTestCase):
|
70 | 69 | """Inherit this class to test your DatasetBuilder class.
|
71 | 70 |
|
72 | 71 | You must set the following class attributes:
|
73 |
| - DATASET_CLASS: class object of DatasetBuilder you want to test. |
| 72 | +
|
| 73 | + * DATASET_CLASS: class object of DatasetBuilder you want to test. |
74 | 74 |
|
75 | 75 | You may set the following class attributes:
|
76 |
| - VERSION: `str`. The version used to run the test. eg: '1.2.*'. |
| 76 | +
|
| 77 | + * VERSION: `str`. The version used to run the test. eg: '1.2.*'. |
77 | 78 | Defaults to None (canonical version).
|
78 |
| - BUILDER_CONFIG_NAMES_TO_TEST: `list[str]`, the list of builder configs |
| 79 | + * BUILDER_CONFIG_NAMES_TO_TEST: `list[str]`, the list of builder configs |
79 | 80 | that should be tested. If None, all the BUILDER_CONFIGS from the class
|
80 | 81 | will be tested.
|
81 |
| - DL_EXTRACT_RESULT: `dict[str]`, the returned result of mocked |
| 82 | + * DL_EXTRACT_RESULT: `dict[str]`, the returned result of mocked |
82 | 83 | `download_and_extract` method. The values should be the path of files
|
83 | 84 | present in the `fake_examples` directory, relative to that directory.
|
84 | 85 | If not specified, path to `fake_examples` will always be returned.
|
85 |
| - EXAMPLE_DIR: `str`, the base directory in in which fake examples are |
| 86 | + * EXAMPLE_DIR: `str`, the base directory in in which fake examples are |
86 | 87 | contained. Optional; defaults to
|
87 | 88 | tensorflow_datasets/testing/test_data/fake_examples/<dataset name>.
|
88 |
| - OVERLAPPING_SPLITS: `list[str]`, splits containing examples from other |
| 89 | + * OVERLAPPING_SPLITS: `list[str]`, splits containing examples from other |
89 | 90 | splits (e.g. a "example" split containing pictures from other splits).
|
90 |
| - MOCK_OUT_FORBIDDEN_OS_FUNCTIONS: `bool`, defaults to True. Set to False to |
| 91 | + * MOCK_OUT_FORBIDDEN_OS_FUNCTIONS: `bool`, defaults to True. Set to False to |
91 | 92 | disable checks preventing usage of `os` or builtin functions instead of
|
92 | 93 | recommended `tf.io.gfile` API.
|
93 | 94 |
|
94 | 95 | This test case will check for the following:
|
| 96 | +
|
95 | 97 | - the dataset builder is correctly registered, i.e. `tfds.load(name)` works;
|
96 | 98 | - the dataset builder can read the fake examples stored in
|
97 | 99 | testing/test_data/fake_examples/${dataset_name};
|
@@ -228,13 +230,6 @@ def _download_and_prepare_as_dataset(self, builder):
|
228 | 230 | manual_dir=self.example_dir,
|
229 | 231 | ):
|
230 | 232 | if isinstance(builder, dataset_builder.BeamBasedBuilder):
|
231 |
| - |
232 |
| - # TODO(b/129148632): The current apache-beam 2.11.0 do not work with Py3 |
233 |
| - # Update once the new version is out (around April) |
234 |
| - skip_beam_test = bool(six.PY3) |
235 |
| - if skip_beam_test: |
236 |
| - return |
237 |
| - |
238 | 233 | import apache_beam as beam # pylint: disable=g-import-not-at-top
|
239 | 234 | # For Beam datasets, set-up the runner config
|
240 | 235 | beam_runner = None
|
|
0 commit comments