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

Function test_file_info_constructor

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

Source from the content-addressed store, hash-verified

560
561
562def test_file_info_constructor():
563 dt = datetime.fromtimestamp(1568799826, timezone.utc)
564
565 info = FileInfo("foo/bar")
566 assert info.path == "foo/bar"
567 assert info.base_name == "bar"
568 assert info.type == FileType.Unknown
569 assert info.size is None
570 check_mtime_absent(info)
571
572 info = FileInfo("foo/baz.txt", type=FileType.File, size=123,
573 mtime=1568799826.5)
574 assert info.path == "foo/baz.txt"
575 assert info.base_name == "baz.txt"
576 assert info.type == FileType.File
577 assert info.size == 123
578 assert info.mtime_ns == 1568799826500000000
579 check_mtime(info)
580
581 info = FileInfo("foo", type=FileType.Directory, mtime=dt)
582 assert info.path == "foo"
583 assert info.base_name == "foo"
584 assert info.type == FileType.Directory
585 assert info.size is None
586 assert info.mtime == dt
587 assert info.mtime_ns == 1568799826000000000
588 check_mtime(info)
589
590
591def test_cannot_instantiate_base_filesystem():

Callers

nothing calls this directly

Calls 3

check_mtime_absentFunction · 0.85
check_mtimeFunction · 0.85
FileInfoClass · 0.50

Tested by

no test coverage detected