Example #1
0
def test_exists_string():
    """Make sure the 'exists' function works with simple strings."""
    os.system('touch sdflkjlkm123')
    assert tests.exists('sdflkjlkm123') is True
    os.system('rm sdflkjlkm123')
    assert tests.exists('sdflkjlkm123') is False
    assert tests.exists('sdfl/kjl/km123') is False
Example #2
0
def test_exists_dict():
    """Make sure the 'exists' function works with dicts."""
    files = create_rm_files('create', 'file')
    dirs = create_rm_files('create', 'dir', 'iosjdf')
    file_list = {}
    for file in files:
        file_list[file] = 'file'
    for dir in dirs:
        file_list[dir] = 'directory'
    assert tests.exists(file_list) is True
    files = create_rm_files('delete', 'file')
    dirs = create_rm_files('delete', 'dir', 'iosjdf')
Example #3
0
def test_exists_listtuple():
    """Make sure the 'exists' function works with tuples and lists."""
    files = create_rm_files('create', 'file')
    assert tests.exists(files) is True
    assert tests.exists(files, 'file') is True
    assert tests.exists(tuple(files), 'file') is True
    create_rm_files('delete', 'file')
    dirs = create_rm_files('create', 'dir')
    assert tests.exists(files)
    assert tests.exists(files, 'dir')
    assert tests.exists(files, 'directory')
    create_rm_files('delete', 'dir')