format with black

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-04-12 14:13:34 +02:00
parent 2a8779295f
commit cd1088a5a9
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
3 changed files with 22 additions and 8 deletions

View file

@ -40,7 +40,9 @@ setup(
include_package_data=True, include_package_data=True,
zip_safe=True, zip_safe=True,
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
extras_require={"gui": ("tkinter"),}, extras_require={
"gui": ("tkinter"),
},
entry_points={ entry_points={
"setuptools.installation": ["eggsecutable = img2pdf:main"], "setuptools.installation": ["eggsecutable = img2pdf:main"],
"console_scripts": ["img2pdf = img2pdf:main"], "console_scripts": ["img2pdf = img2pdf:main"],

View file

@ -2283,6 +2283,7 @@ def input_images(path_expr):
# glob won't return files that don't exist so we only use it for wildcards # glob won't return files that don't exist so we only use it for wildcards
# paths without wildcards that do not exist will trigger "does not exist" # paths without wildcards that do not exist will trigger "does not exist"
from glob import glob from glob import glob
paths = glob(path_expr) paths = glob(path_expr)
for path in paths: for path in paths:
try: try:

View file

@ -776,6 +776,7 @@ def tmp_icc_profile(tmp_path_factory):
yield tmp_icc_profile yield tmp_icc_profile
tmp_icc_profile.unlink() tmp_icc_profile.unlink()
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tmp_icc_png(tmp_path_factory, alpha, tmp_icc_profile): def tmp_icc_png(tmp_path_factory, alpha, tmp_icc_profile):
normal16 = alpha[:, :, 0:3] normal16 = alpha[:, :, 0:3]
@ -6542,10 +6543,14 @@ def test_general(general_input, engine):
assert cur_page.Resources.XObject.keys() == {"/Im0"} assert cur_page.Resources.XObject.keys() == {"/Im0"}
if engine != img2pdf.Engine.pikepdf: if engine != img2pdf.Engine.pikepdf:
assert cur_page.Contents.Length == len(cur_page.Contents.read_bytes()) assert cur_page.Contents.Length == len(cur_page.Contents.read_bytes())
assert cur_page.Contents.read_bytes() == b"q\n%.4f 0 0 %.4f 0.0000 0.0000 cm\n/Im0 Do\nQ" % ( assert (
cur_page.Contents.read_bytes()
== b"q\n%.4f 0 0 %.4f 0.0000 0.0000 cm\n/Im0 Do\nQ"
% (
pagewidth, pagewidth,
pageheight, pageheight,
) )
)
imgprops = cur_page.Resources.XObject.Im0 imgprops = cur_page.Resources.XObject.Im0
@ -6682,7 +6687,7 @@ def test_general(general_input, engine):
def main(): def main():
normal16 = alpha_value()[:, :, 0:3] normal16 = alpha_value()[:, :, 0:3]
pathlib.Path('test.icc').write_bytes(icc_profile()) pathlib.Path("test.icc").write_bytes(icc_profile())
write_png( write_png(
normal16 / 0xFFFF * 0xFF, normal16 / 0xFFFF * 0xFF,
"icc.png", "icc.png",
@ -6690,6 +6695,12 @@ def main():
2, 2,
iccp="test.icc", iccp="test.icc",
) )
write_png(
normal16 / 0xFFFF * 0xFF,
"normal.png",
8,
2,
)
if __name__ == "__main__": if __name__ == "__main__":