From: Peter Pentchev Date: Fri, 12 Aug 2022 08:51:42 +0000 (+0300) Subject: debian/tests/pychunk: reformat, 100 chars per line. X-Git-Tag: archive/raspbian/1.2.3+ds1-2+rpi1^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5476e3b2ae7c1ff80ba78d447d9cb156824a1d8e;p=zchunk.git debian/tests/pychunk: reformat, 100 chars per line. --- diff --git a/debian/tests/pychunk/common.py b/debian/tests/pychunk/common.py index acf00b2..a64e424 100644 --- a/debian/tests/pychunk/common.py +++ b/debian/tests/pychunk/common.py @@ -79,16 +79,11 @@ def do_compress(cfg: Config, orig_size: int) -> int: comp_size = cfg.compressed.stat().st_size print(f"{cfg.compressed} size is {comp_size} bytes long") if comp_size >= orig_size: - sys.exit( - f"sizeof({cfg.compressed}) == {comp_size} : " - f"sizeof({cfg.orig}) == {orig_size}" - ) + sys.exit(f"sizeof({cfg.compressed}) == {comp_size} : sizeof({cfg.orig}) == {orig_size}") start = cfg.compressed.open(mode="rb").read(5) print(f"{cfg.compressed} starts with {start!r}") if start != defs.MAGIC: - sys.exit( - f"{cfg.compressed} does not start with {defs.MAGIC!r}: {start!r}" - ) + sys.exit(f"{cfg.compressed} does not start with {defs.MAGIC!r}: {start!r}") return comp_size @@ -147,28 +142,17 @@ def read_chunks(cfg: Config, orig_size: int, comp_size: int) -> Chunk: end=last_chunk.end + size, ) if next_chunk.cend > comp_size: - sys.exit( - f"Compressed size overflow: {next_chunk.cend} > {comp_size}" - ) + sys.exit(f"Compressed size overflow: {next_chunk.cend} > {comp_size}") more = idx + 1 != params["chunk_count"] if more: if next_chunk.end >= orig_size: - sys.exit( - f"Original size overflow: " - f"{next_chunk.end} >= {orig_size}" - ) + sys.exit(f"Original size overflow: {next_chunk.end} >= {orig_size}") else: if next_chunk.cend != comp_size: - sys.exit( - f"Compressed size mismatch: " - f"{next_chunk.cend} != {comp_size}" - ) + sys.exit(f"Compressed size mismatch: {next_chunk.cend} != {comp_size}") if next_chunk.end != orig_size: - sys.exit( - f"Original size mismatch: " - f"{next_chunk.end} != {orig_size}" - ) + sys.exit(f"Original size mismatch: {next_chunk.end} != {orig_size}") print(f"- appending {next_chunk!r}") chunks.append(next_chunk) @@ -207,9 +191,7 @@ def read_chunks(cfg: Config, orig_size: int, comp_size: int) -> Chunk: size = int(data.group("size")) if size < 1 or size > comp_size: - sys.exit( - f"zck_read_header said data size {size} (comp {comp_size})" - ) + sys.exit(f"zck_read_header said data size {size} (comp {comp_size})") params["size_diff"] = comp_size - size return "wait_for_chunk_count" diff --git a/debian/tests/pychunk/compile.py b/debian/tests/pychunk/compile.py index e87e09c..4262691 100755 --- a/debian/tests/pychunk/compile.py +++ b/debian/tests/pychunk/compile.py @@ -53,9 +53,7 @@ def do_compile(cfg: Config) -> None: """Compile the test program.""" print("Fetching the C compiler flags for zck") cflags = ( - subprocess.check_output( - ["pkg-config", "--cflags", "zck"], shell=False, env=cfg.env - ) + subprocess.check_output(["pkg-config", "--cflags", "zck"], shell=False, env=cfg.env) .decode("UTF-8") .rstrip("\r\n") ) @@ -72,9 +70,7 @@ def do_compile(cfg: Config) -> None: print("Fetching the C linker flags and libraries for zck") libs = ( - subprocess.check_output( - ["pkg-config", "--libs", "zck"], shell=False, env=cfg.env - ) + subprocess.check_output(["pkg-config", "--libs", "zck"], shell=False, env=cfg.env) .decode("UTF-8") .rstrip("\r\n") ) @@ -112,16 +108,10 @@ def compare_chunk(cfg: Config, second: common.Chunk, orig_size: int) -> None: # OK, let's load it all into memory, mmkay? contents = cfg.orig.read_bytes() if len(contents) != orig_size: - sys.exit( - f"Could not read {orig_size} bytes from {cfg.orig}, " - f"read {len(contents)}" - ) + sys.exit(f"Could not read {orig_size} bytes from {cfg.orig}, read {len(contents)}") chunk = cfg.uncompressed.read_bytes() if len(chunk) != second.size: - sys.exit( - f"Could not read {second.size} bytes from {cfg.uncompressed}, " - f"read {len(chunk)}" - ) + sys.exit(f"Could not read {second.size} bytes from {cfg.uncompressed}, read {len(chunk)}") if contents[second.start : second.start + second.size] != chunk: sys.exit("Mismatch!") diff --git a/debian/tests/pychunk/roundtrip.py b/debian/tests/pychunk/roundtrip.py index b7b003f..6c054e8 100755 --- a/debian/tests/pychunk/roundtrip.py +++ b/debian/tests/pychunk/roundtrip.py @@ -68,9 +68,7 @@ def do_uncompress(cfg: Config, orig_size: int) -> None: sys.exit(f"Uncompressed size {new_size} != original size {orig_size}") print(f"Comparing {cfg.orig} to {cfg.uncompressed}") - subprocess.check_call( - ["cmp", "--", cfg.orig, cfg.uncompressed], shell=False, env=cfg.env - ) + subprocess.check_call(["cmp", "--", cfg.orig, cfg.uncompressed], shell=False, env=cfg.env) def do_recompress(cfg: Config, comp_size: int) -> None: @@ -93,9 +91,7 @@ def do_recompress(cfg: Config, comp_size: int) -> None: new_size = cfg.recompressed.stat().st_size print(f"Recompressed size {new_size}") if new_size != comp_size: - sys.exit( - f"Recompressed size {new_size} != compressed size {comp_size}" - ) + sys.exit(f"Recompressed size {new_size} != compressed size {comp_size}") print(f"Comparing {cfg.compressed} to {cfg.recompressed}") subprocess.check_call( diff --git a/debian/tests/pyproject.toml b/debian/tests/pyproject.toml index 783a0c5..f3592ef 100644 --- a/debian/tests/pyproject.toml +++ b/debian/tests/pyproject.toml @@ -1,5 +1,5 @@ [tool.black] -line-length = 79 +line-length = 100 [tool.mypy] strict = true diff --git a/debian/tests/setup.cfg b/debian/tests/setup.cfg index b6c4e58..64a874a 100644 --- a/debian/tests/setup.cfg +++ b/debian/tests/setup.cfg @@ -1,3 +1,4 @@ [flake8] # Leave the formatting to the black tool. extend-ignore = E203 +max-line-length = 100