MCPcopy
hub / github.com/pytest-dev/pytest / test_bestrelpath

Method test_bestrelpath

testing/_py/test_local.py:153–165  ·  view source on GitHub ↗
(self, path1)

Source from the content-addressed store, hash-verified

151 assert not path1.check(relto=p)
152
153 def test_bestrelpath(self, path1):
154 curdir = path1
155 sep = curdir.sep
156 s = curdir.bestrelpath(curdir)
157 assert s == "."
158 s = curdir.bestrelpath(curdir.join("hello", "world"))
159 assert s == "hello" + sep + "world"
160
161 s = curdir.bestrelpath(curdir.dirpath().join("sister"))
162 assert s == ".." + sep + "sister"
163 assert curdir.bestrelpath(curdir.dirpath()) == ".."
164
165 assert curdir.bestrelpath("hello") == "hello"
166
167 def test_relto_not_relative(self, path1):
168 l1 = path1.join("bcde")

Callers

nothing calls this directly

Calls 3

bestrelpathMethod · 0.80
joinMethod · 0.80
dirpathMethod · 0.80

Tested by

no test coverage detected