MCPcopy Create free account
hub / github.com/tensorflow/datasets / test_mock_fs_gcs

Function test_mock_fs_gcs

tensorflow_datasets/testing/test_utils_test.py:184–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182
183
184def test_mock_fs_gcs():
185 with test_utils.MockFs():
186 tf.io.gfile.makedirs('gs://bucket/dir/subdir')
187 assert tf.io.gfile.exists('gs://bucket/dir')
188 assert tf.io.gfile.exists('gs://bucket/dir/subdir')
189
190 with tf.io.gfile.GFile('gs://bucket/dir/file.txt', 'w') as f:
191 f.write('Content of file')
192
193 assert set(tf.io.gfile.listdir('gs://bucket/dir')) == {
194 'file.txt',
195 'subdir',
196 }
197
198 bs = 'big' + 'store'
199
200 # Test
201 # * gs
202 # * absolute path
203 # * relative path
204 assert tf.io.gfile.glob('gs://bucket/*/file.txt') == [
205 'gs://bucket/dir/file.txt',
206 ]
207 assert tf.io.gfile.glob(f'/{bs}/bucket/*/file.txt') == [
208 f'/{bs}/bucket/dir/file.txt',
209 ]
210 assert tf.io.gfile.glob(f'{bs}/bucket/*/file.txt') == [
211 f'{bs}/bucket/dir/file.txt',
212 ]
213
214
215def test_gcs_access():

Callers

nothing calls this directly

Calls 2

existsMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected