def test_suffixes():
    for suffix, mode, type in imp.get_suffixes():
        if mode == imp.PY_SOURCE:
            assert suffix == '.py'
            assert type == 'r'
        elif mode == imp.PY_COMPILED:
            assert suffix in ('.pyc', '.pyo')
            assert type == 'rb'
Exemple #2
0
def test_suffixes():
    for suffix, mode, type in imp.get_suffixes():
        if mode == imp.PY_SOURCE:
            assert suffix == '.py'
            assert type == 'r'
        elif mode == imp.PY_COMPILED:
            assert suffix in ('.pyc', '.pyo')
            assert type == 'rb'
def test_find_module():
    file, pathname, description = imp.find_module('StringIO')
    assert file is not None
    file.close()
    assert os.path.exists(pathname)
    pathname = pathname.lower()
    assert (pathname.endswith('.py') or pathname.endswith('.pyc')
                                     or pathname.endswith('.pyo'))
    assert description in imp.get_suffixes()
Exemple #4
0
def test_find_module():
    file, pathname, description = imp.find_module('StringIO')
    assert file is not None
    file.close()
    assert os.path.exists(pathname)
    pathname = pathname.lower()
    assert (pathname.endswith('.py') or pathname.endswith('.pyc')
            or pathname.endswith('.pyo'))
    assert description in imp.get_suffixes()