Files
dvc/tests/func/test_utils.py
T
Saugat Pachhai b8aa8ad951 pyupgrade: 3.6+ (#3805)
* pyupgrade: 3.6+

* tests: pyupgrade 3.6+
2020-05-15 16:48:02 +03:00

43 lines
1.0 KiB
Python

from dvc import utils
def test_file_md5_crlf(tmp_dir):
tmp_dir.gen("cr", b"a\nb\nc")
tmp_dir.gen("crlf", b"a\r\nb\r\nc")
assert utils.file_md5("cr")[0] == utils.file_md5("crlf")[0]
def test_dict_md5():
d = {
"cmd": "python code.py foo file1",
"locked": "true",
"outs": [
{
"path": "file1",
"metric": {"type": "raw"},
"cache": False,
"md5": "acbd18db4cc2f85cedef654fccc4a4d8",
}
],
"deps": [
{"path": "foo", "md5": "acbd18db4cc2f85cedef654fccc4a4d8"},
{"path": "code.py", "md5": "d05447644b89960913c7eee5fd776adb"},
],
}
md5 = "8b263fa05ede6c3145c164829be694b4"
assert md5 == utils.dict_md5(d, exclude=["metric", "locked"])
def test_boxify():
expected = (
"+-----------------+\n"
"| |\n"
"| message |\n"
"| |\n"
"+-----------------+\n"
)
assert expected == utils.boxify("message")