Example #1
0
def test_os_error() -> None:
    old_size = 5
    new_size = 50
    old_format = _PNG_FORMAT
    new_format = _PNG_FORMAT
    settings = Settings()
    settings.bigger = True
    settings.test = True
    (path, b_in,
     b_out), old_path, new_path = _cleanup_aux(old_size, new_size, old_format,
                                               new_format, settings, True)
    assert path.suffix == ""
    assert 0 == b_in
    assert 0 == b_out
    _teardown()
Example #2
0
def test_small_big_format_change_bigger() -> None:
    old_size = 5
    new_size = 50
    old_format = _BMP_FORMAT
    new_format = _PNG_FORMAT
    settings = Settings()
    settings.bigger = True
    (path, b_in,
     b_out), old_path, new_path = _cleanup_aux(old_size, new_size, old_format,
                                               new_format, settings)
    assert new_path.is_file()
    assert not old_path.exists()
    assert new_path == old_path.with_suffix(_fmt_to_suffix(new_format))
    assert old_size == b_in
    assert new_size == b_out
    _teardown()
Example #3
0
def test_small_big_bigger() -> None:
    old_size = 5
    new_size = 50
    old_format = _PNG_FORMAT
    new_format = _PNG_FORMAT
    settings = Settings()
    settings.bigger = True
    (path, b_in,
     b_out), old_path, new_path = _cleanup_aux(old_size, new_size, old_format,
                                               new_format, settings)
    print(new_path)
    assert old_path.is_file()
    assert new_path == old_path
    assert old_size == b_in
    assert new_size == b_out
    assert new_size == old_path.stat().st_size
    _teardown()
Example #4
0
def test_walk_comic_archive_bigger() -> None:
    _teardown()
    TMP_ROOT.mkdir()
    cbr = TMP_ROOT / "test.cbr"
    cbz = TMP_ROOT / "test.cbz"
    shutil.copy(TEST_CBR_SRC, cbr)
    old_size = cbr.stat().st_size
    settings = Settings()
    settings.comics = True
    settings.bigger = True
    wob = Walk(settings)
    result_set = wob.walk_comic_archive(cbr, "CBR", None)
    res = result_set.pop()
    rep = res.get()
    assert not rep.error
    assert rep.final_path == cbz
    assert rep.bytes_in == old_size
    assert rep.bytes_out > 0
    wob._pool.close()
    wob._pool.join()
    _teardown()