MCPcopy Create free account
hub / github.com/apache/arrow / test_py_filesystem_get_file_info_selector

Function test_py_filesystem_get_file_info_selector

python/pyarrow/tests/test_fs.py:1855–1881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1853
1854
1855def test_py_filesystem_get_file_info_selector():
1856 handler = DummyHandler()
1857 fs = PyFileSystem(handler)
1858
1859 selector = FileSelector(base_dir="somedir")
1860 infos = fs.get_file_info(selector)
1861 assert len(infos) == 2
1862 assert infos[0].path == "somedir/file1"
1863 assert infos[0].type == FileType.File
1864 assert infos[0].size == 123
1865 assert infos[1].path == "somedir/subdir1"
1866 assert infos[1].type == FileType.Directory
1867 assert infos[1].size is None
1868
1869 selector = FileSelector(base_dir="somedir", recursive=True)
1870 infos = fs.get_file_info(selector)
1871 assert len(infos) == 3
1872 assert infos[0].path == "somedir/file1"
1873 assert infos[1].path == "somedir/subdir1"
1874 assert infos[2].path == "somedir/subdir1/file2"
1875
1876 selector = FileSelector(base_dir="notfound")
1877 with pytest.raises(FileNotFoundError):
1878 fs.get_file_info(selector)
1879
1880 selector = FileSelector(base_dir="notfound", allow_not_found=True)
1881 assert fs.get_file_info(selector) == []
1882
1883
1884def test_py_filesystem_ops():

Callers

nothing calls this directly

Calls 4

DummyHandlerClass · 0.85
lenFunction · 0.85
FileSelectorClass · 0.50
get_file_infoMethod · 0.45

Tested by

no test coverage detected