forked from iterative/dvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
url info and repo grap optimization: address review comments
- Loading branch information
1 parent
0abf530
commit 8fd18f5
Showing
3 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
from dvc.path_info import URLInfo | ||
import pytest | ||
|
||
from dvc.path_info import URLInfo, CloudURLInfo | ||
|
||
def test_url_info_str(): | ||
u = URLInfo("ssh://[email protected]:/test1/") | ||
|
||
@pytest.mark.parametrize("cls", [URLInfo, CloudURLInfo]) | ||
def test_url_info_str(cls): | ||
u = cls("ssh://[email protected]:/test1/") | ||
assert u.url == "ssh://[email protected]/test1/" | ||
assert str(u) == u.url | ||
|
||
|
||
def test_url_info_eq(): | ||
u1 = URLInfo("ssh://[email protected]:/test1/") | ||
u2 = URLInfo("ssh://[email protected]/test1") | ||
@pytest.mark.parametrize("cls", [URLInfo, CloudURLInfo]) | ||
def test_url_info_eq(cls): | ||
u1 = cls("ssh://[email protected]:/test1/") | ||
u2 = cls("ssh://[email protected]/test1") | ||
assert u1 == u2 | ||
|
||
|
||
def test_url_info_parent(): | ||
u1 = URLInfo("ssh://[email protected]:/test1/test2") | ||
@pytest.mark.parametrize("cls", [URLInfo, CloudURLInfo]) | ||
def test_url_info_parent(cls): | ||
u1 = cls("ssh://[email protected]:/test1/test2") | ||
p = u1.parent | ||
u3 = URLInfo("ssh://[email protected]/test1") | ||
u3 = cls("ssh://[email protected]/test1") | ||
assert u3 == p | ||
assert str(p) == "ssh://[email protected]/test1" | ||
|
||
|
||
def test_url_info_parents(): | ||
u1 = URLInfo("ssh://[email protected]:/test1/test2/test3") | ||
parents = u1.parents | ||
assert len(parents) == 3 | ||
assert parents[0] == URLInfo("ssh://[email protected]/test1/test2") | ||
assert parents[1] == URLInfo("ssh://[email protected]/test1") | ||
assert parents[2] == URLInfo("ssh://[email protected]/") | ||
@pytest.mark.parametrize("cls", [URLInfo, CloudURLInfo]) | ||
def test_url_info_parents(cls): | ||
u1 = cls("ssh://[email protected]:/test1/test2/test3") | ||
assert list(u1.parents) == [ | ||
cls("ssh://[email protected]/test1/test2"), | ||
cls("ssh://[email protected]/test1"), | ||
cls("ssh://[email protected]/"), | ||
] |