Test `MockPolicy.AUTO` fallback to `USE_CODE`.
(tmp_path)
| 175 | |
| 176 | |
| 177 | def test_mock_data_auto(tmp_path): |
| 178 | """Test `MockPolicy.AUTO` fallback to `USE_CODE`.""" |
| 179 | # By default, mock data should load metadata when present. |
| 180 | with tfds.testing.mock_data(): |
| 181 | builder = tfds.builder('mnist') |
| 182 | assert list(builder.info.splits.keys()) # Metadata should loaded. |
| 183 | |
| 184 | # When mock data unknown, fallback to `USE_CODE` mode. |
| 185 | with tfds.testing.mock_data(data_dir=tmp_path): |
| 186 | builder = tfds.builder('mnist') |
| 187 | assert not list(builder.info.splits.keys()) # Metadata unknown. |
| 188 | |
| 189 | |
| 190 | def test_mock_data_use_code(): |