示例#1
0
def test_guess_filename_with_default() -> None:
    assert (helpers.guess_filename(None, 'no-throw') == 'no-throw')
示例#2
0
def test_guess_filename_with_file_object(tmp_path) -> None:
    file_path = tmp_path / 'test_guess_filename'
    with file_path.open('w+b') as fp:
        assert (helpers.guess_filename(fp, 'no-throw') is not None)
示例#3
0
def test_guess_filename_with_path(tmp_path) -> None:
    file_path = tmp_path / 'test_guess_filename'
    assert (helpers.guess_filename(file_path, 'no-throw') is not None)
示例#4
0
def test_guess_filename_with_default() -> None:
    assert helpers.guess_filename(None, "no-throw") == "no-throw"
示例#5
0
def test_guess_filename_with_path(tmp_path) -> None:
    file_path = tmp_path / "test_guess_filename"
    assert helpers.guess_filename(file_path, "no-throw") is not None
示例#6
0
def test_guess_filename_with_file_object(tmp_path) -> None:
    file_path = tmp_path / "test_guess_filename"
    with file_path.open("w+b") as fp:
        assert helpers.guess_filename(fp, "no-throw") is not None
示例#7
0
def test_guess_filename_with_tempfile() -> None:
    with tempfile.TemporaryFile() as fp:
        assert (helpers.guess_filename(fp, 'no-throw') is not None)
示例#8
0
def test_guess_filename_with_tempfile():
    with tempfile.TemporaryFile() as fp:
        assert (helpers.guess_filename(fp, 'no-throw') is not None)