Ejemplo n.º 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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 10
0
def test_init_relative():
    filename = "somefile.ext"
    relative_path = f"../{filename}"
    fi = FileInfo(relative_path)
    assert fi.filename == filename
Ejemplo n.º 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
Ejemplo n.º 12
0
def test_init():
    filename = 'my_file_name.txt'
    f = FileInfo(filename)
    assert f.filename == filename
Ejemplo n.º 13
0
def test_init_relative():
    filename = 'somefile.ext'
    relative_path = '../{}'.format(filename)
    fi = FileInfo(relative_path)
    assert fi.filename == filename
Ejemplo n.º 14
0
def test_init():
    filename = 'hola.txt'
    fi = FileInfo(filename)
    assert fi.filename == filename
Ejemplo n.º 15
0
def test_init_relative_path():
    filename = 'hola.txt'
    relative_path = '../{}'.format(filename)

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