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

Method common

src/_pytest/_py/path.py:505–514  ·  view source on GitHub ↗

Return the common part shared with the other path or None if there is no common part.

(self, other)

Source from the content-addressed store, hash-verified

503 return lst
504
505 def common(self, other):
506 """Return the common part shared with the other path
507 or None if there is no common part.
508 """
509 last = None
510 for x, y in zip(self.parts(), other.parts()):
511 if x != y:
512 return last
513 last = x
514 return last
515
516 def __add__(self, other):
517 """Return new path object with 'other' added to the basename"""

Callers 5

mksymlinktoMethod · 0.95
bestrelpathMethod · 0.95
test_commonMethod · 0.80
test_commondirMethod · 0.80

Calls 1

partsMethod · 0.95

Tested by 3

test_commonMethod · 0.64
test_commondirMethod · 0.64