示例#1
0
def test_uninstallation_paths() -> None:
    class dist:
        def iter_declared_entries(self) -> Optional[Iterator[str]]:
            yield "file.py"
            yield "file.pyc"
            yield "file.so"
            yield "nopyc.py"

        location = ""

    d = dist()

    paths = list(uninstallation_paths(d))

    expected = [
        "file.py",
        "file.pyc",
        "file.pyo",
        "file.so",
        "nopyc.py",
        "nopyc.pyc",
        "nopyc.pyo",
    ]

    assert paths == expected

    # Avoid an easy 'unique generator' bug
    paths2 = list(uninstallation_paths(d))

    assert paths2 == paths
示例#2
0
def test_uninstallation_paths():
    class dist(object):
        def get_metadata_lines(self, record):
            return ['file.py,,',
                    'file.pyc,,',
                    'file.so,,',
                    'nopyc.py']
        location = ''

    d = dist()

    paths = list(uninstallation_paths(d))

    expected = ['file.py',
                'file.pyc',
                'file.pyo',
                'file.so',
                'nopyc.py',
                'nopyc.pyc',
                'nopyc.pyo']

    assert paths == expected

    # Avoid an easy 'unique generator' bug
    paths2 = list(uninstallation_paths(d))

    assert paths2 == paths
示例#3
0
def test_uninstallation_paths():
    class dist(object):
        def get_metadata_lines(self, record):
            return ['file.py,,',
                    'file.pyc,,',
                    'file.so,,',
                    'nopyc.py']
        location = ''

    d = dist()

    paths = list(uninstallation_paths(d))

    expected = ['file.py',
                'file.pyc',
                'file.so',
                'nopyc.py',
                'nopyc.pyc']

    assert paths == expected

    # Avoid an easy 'unique generator' bug
    paths2 = list(uninstallation_paths(d))

    assert paths2 == paths