mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
remote: is_dir_checksum: handle empty/None checksum (#3836)
Fixed #3434
This commit is contained in:
@@ -319,6 +319,8 @@ class BaseRemote:
|
||||
|
||||
@classmethod
|
||||
def is_dir_checksum(cls, checksum):
|
||||
if not checksum:
|
||||
return False
|
||||
return checksum.endswith(cls.CHECKSUM_DIR_SUFFIX)
|
||||
|
||||
def get_checksum(self, path_info):
|
||||
|
||||
@@ -136,3 +136,11 @@ def test_cache_checksums(dvc):
|
||||
):
|
||||
checksums = list(remote.cache_checksums())
|
||||
assert checksums == ["123456"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"checksum, result",
|
||||
[(None, False), ("", False), ("3456.dir", True), ("3456", False)],
|
||||
)
|
||||
def test_is_dir_checksum(checksum, result):
|
||||
assert BaseRemote.is_dir_checksum(checksum) == result
|
||||
|
||||
Reference in New Issue
Block a user