Files
dvc/tests/func/objects/test_hash.py
T
Saugat Pachhai (सौगात) 3f5757a0a5 dvc.objects: move hashing functions to dvc.objects
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`.
2022-05-12 20:33:18 +03:00

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)