Beispiel #1
0
def test_get_info():
    filename = 'somefile.ext'
    original_path = '../{}'.format(filename)
    with patch('os.path.abspath') as abspath_mock:
        test_abspath = 'some/abs/path'
        abspath_mock.return_value = test_abspath
        fi = FileInfo(original_path)
        assert fi.get_info() == (filename, original_path, test_abspath)
def test_get_info(abspath_mock):
    test_abspath = 'some/abs/path'
    abspath_mock.return_value = test_abspath

    filename = 'somefile.ext'
    original_path = '../auxiliar_files/{}'.format(filename)

    fi = FileInfo(original_path)
    assert fi.get_info()==(filename, original_path, test_abspath)
def test_get_info_with_decorator(abspath_mock, getsize_mock):
    filename = "somefile.ext"
    original_path = "../{}".format(filename)

    test_abspath = "some/abs/path"
    abspath_mock.return_value = test_abspath
    test_size = 1234
    getsize_mock.return_value = test_size
    fi = FileInfo(original_path)
    assert fi.get_info() == (filename, original_path, test_abspath, test_size)
Beispiel #4
0
def test_get_info(abspath_mock, getsize_mock):
    filename = 'somefile.ext'
    original_path = '../{}'.format(filename)

    test_abspath = 'some/abs/path'
    abspath_mock.return_value = test_abspath

    test_size = 1234
    getsize_mock.return_value = test_size

    fi = FileInfo(original_path)
    assert fi.get_info() == (filename, original_path, test_abspath, test_size)
def test_get_info():
    filename = "somefile.ext"
    original_path = "../{}".format(filename)

    with patch('os.path.abspath') as abspath_mock:
        test_abspath = 'some/abs/path'
        abspath_mock.return_value = test_abspath
        with patch('os.path.getsize') as getsize_mock:
            test_size = 1234
            getsize_mock.return_value = test_size
            fi = FileInfo(original_path)
            assert fi.get_info() == (filename, original_path, test_abspath,
                                     test_size)
Beispiel #6
0
def test_get_info(abspath_mock, getsize_mock):
    filename = "somefile.ext"
    original_path = f"../{filename}"

    test_abspath = "some/abs/path"
    abspath_mock.return_value = test_abspath

    test_size = 1234
    getsize_mock.return_value = test_size

    fi = FileInfo(original_path)
    info = fi.get_info()

    abspath_mock.assert_called_with(original_path)
    getsize_mock.assert_called_with(original_path)
    assert fi.get_info() == (filename, original_path, test_abspath, test_size)
Beispiel #7
0
def test_get_info(abspath_mock, getsize_mock):
    test_abspath = 'some/abs/path'
    abspath_mock.return_value = test_abspath

    filename = 'somefile.ext'
    original_path = '../{}'.format(filename)

    test_size = 1234
    getsize_mock.return_value = test_size

    fi = FileInfo(original_path)
    info = fi.get_info()

    abspath_mock.assert_called_with(original_path)
    getsize_mock.assert_called_with(original_path)
    assert info == (filename, original_path, test_abspath, test_size)
def test_init_relative():
    filename = "somefile.ext"
    relative_path = "../{}".format(filename)
    fi = FileInfo(relative_path)

    assert fi.filename == filename
def test_init():
    filename = "somefile.ext"
    fi = FileInfo(filename)
    assert fi.filename == filename
Beispiel #10
0
def test_init_relative():
    filename = "somefile.ext"
    relative_path = f"../{filename}"
    fi = FileInfo(relative_path)
    assert fi.filename == filename
Beispiel #11
0
def test_init_relative():
    filename = 'my_file_name_with_another_extension.ext'
    relative_path = f'../{filename}'
    f = FileInfo(relative_path)
    assert f.filename == filename
Beispiel #12
0
def test_init():
    filename = 'my_file_name.txt'
    f = FileInfo(filename)
    assert f.filename == filename
Beispiel #13
0
def test_init_relative():
    filename = 'somefile.ext'
    relative_path = '../{}'.format(filename)
    fi = FileInfo(relative_path)
    assert fi.filename == filename
def test_init():
    filename = 'hola.txt'
    fi = FileInfo(filename)
    assert fi.filename == filename
def test_init_relative_path():
    filename = 'hola.txt'
    relative_path = '../{}'.format(filename)

    fi = FileInfo(relative_path)
    assert fi.filename == filename