mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
This commit moves `HashedStreamReader`/`get_hash_file`/`file_md5` into `dvc.objects.hash`. The `get_hash_file` has been renamed to `hash_file`. This also copies `relpath` and `is_exec` to the `dvc.fs.utils`.
17 lines
413 B
Python
17 lines
413 B
Python
from dvc.fs import LocalFileSystem
|
|
from dvc.objects.hash import file_md5
|
|
|
|
|
|
def test_file_md5(tmp_dir):
|
|
tmp_dir.gen("foo", "foo content")
|
|
|
|
fs = LocalFileSystem()
|
|
assert file_md5("foo", fs) == file_md5("foo", fs)
|
|
|
|
|
|
def test_file_md5_crlf(tmp_dir):
|
|
fs = LocalFileSystem()
|
|
tmp_dir.gen("cr", b"a\nb\nc")
|
|
tmp_dir.gen("crlf", b"a\r\nb\r\nc")
|
|
assert file_md5("cr", fs) == file_md5("crlf", fs)
|