

def test_compact_shorter_path(self, monkeypatch):
    monkeypatch.setattr(pip.req.req_uninstall, 'is_local', (lambda p: True))
    monkeypatch.setattr('os.path.exists', (lambda p: True))
    short_path = os.path.normcase(os.path.abspath(os.path.join(os.path.sep, 'path')))
    ups = UninstallPathSet(dist=Mock())
    ups.add(short_path)
    ups.add(os.path.join(short_path, 'longer'))
    assert (ups.compact(ups.paths) == set([short_path]))

dataset/ETHPy150Open pypa/pip/tests/unit/test_req_uninstall.py TestUninstallPathSet.test_compact_shorter_path/original