From 0abf530bef0b3cdbcf58571db4120393b10429f1 Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Thu, 4 Jul 2019 19:34:43 -0700 Subject: [PATCH] tests: add tests for some previously failing calls in url info --- tests/unit/test_path_info.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/unit/test_path_info.py diff --git a/tests/unit/test_path_info.py b/tests/unit/test_path_info.py new file mode 100644 index 000000000..72479f9f1 --- /dev/null +++ b/tests/unit/test_path_info.py @@ -0,0 +1,30 @@ +from dvc.path_info import URLInfo + + +def test_url_info_str(): + u = URLInfo("ssh://user@test.com:/test1/") + assert u.url == "ssh://user@test.com/test1/" + assert str(u) == u.url + + +def test_url_info_eq(): + u1 = URLInfo("ssh://user@test.com:/test1/") + u2 = URLInfo("ssh://user@test.com/test1") + assert u1 == u2 + + +def test_url_info_parent(): + u1 = URLInfo("ssh://user@test.com:/test1/test2") + p = u1.parent + u3 = URLInfo("ssh://user@test.com/test1") + assert u3 == p + assert str(p) == "ssh://user@test.com/test1" + + +def test_url_info_parents(): + u1 = URLInfo("ssh://user@test.com:/test1/test2/test3") + parents = u1.parents + assert len(parents) == 3 + assert parents[0] == URLInfo("ssh://user@test.com/test1/test2") + assert parents[1] == URLInfo("ssh://user@test.com/test1") + assert parents[2] == URLInfo("ssh://user@test.com/")