mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
add Python version to selftest, rename brief parameter
This commit is contained in:
parent
5f4c1e113c
commit
accbe58b5e
|
@ -70,11 +70,14 @@ class TestFeatures(PillowTestCase):
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
self.assertEqual(lines[0], "-" * 68)
|
self.assertEqual(lines[0], "-" * 68)
|
||||||
self.assertTrue(lines[1].startswith("Pillow "))
|
self.assertTrue(lines[1].startswith("Pillow "))
|
||||||
self.assertEqual(lines[2], "-" * 68)
|
self.assertTrue(lines[2].startswith("Python "))
|
||||||
self.assertTrue(lines[3].startswith("Python modules loaded from "))
|
lines = lines[3:]
|
||||||
self.assertTrue(lines[4].startswith("Binary modules loaded from "))
|
while lines[0].startswith(" "):
|
||||||
self.assertEqual(lines[5], "-" * 68)
|
lines = lines[1:]
|
||||||
self.assertTrue(lines[6].startswith("Python "))
|
self.assertEqual(lines[0], "-" * 68)
|
||||||
|
self.assertTrue(lines[1].startswith("Python modules loaded from "))
|
||||||
|
self.assertTrue(lines[2].startswith("Binary modules loaded from "))
|
||||||
|
self.assertEqual(lines[3], "-" * 68)
|
||||||
jpeg = (
|
jpeg = (
|
||||||
"\n"
|
"\n"
|
||||||
+ "-" * 68
|
+ "-" * 68
|
||||||
|
|
|
@ -12,11 +12,14 @@ class TestMain(TestCase):
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
self.assertEqual(lines[0], "-" * 68)
|
self.assertEqual(lines[0], "-" * 68)
|
||||||
self.assertTrue(lines[1].startswith("Pillow "))
|
self.assertTrue(lines[1].startswith("Pillow "))
|
||||||
self.assertEqual(lines[2], "-" * 68)
|
self.assertTrue(lines[2].startswith("Python "))
|
||||||
self.assertTrue(lines[3].startswith("Python modules loaded from "))
|
lines = lines[3:]
|
||||||
self.assertTrue(lines[4].startswith("Binary modules loaded from "))
|
while lines[0].startswith(" "):
|
||||||
self.assertEqual(lines[5], "-" * 68)
|
lines = lines[1:]
|
||||||
self.assertTrue(lines[6].startswith("Python "))
|
self.assertEqual(lines[0], "-" * 68)
|
||||||
|
self.assertTrue(lines[1].startswith("Python modules loaded from "))
|
||||||
|
self.assertTrue(lines[2].startswith("Binary modules loaded from "))
|
||||||
|
self.assertEqual(lines[3], "-" * 68)
|
||||||
jpeg = (
|
jpeg = (
|
||||||
os.linesep
|
os.linesep
|
||||||
+ "-" * 68
|
+ "-" * 68
|
||||||
|
|
|
@ -161,7 +161,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
exit_status = 0
|
exit_status = 0
|
||||||
|
|
||||||
features.pilinfo(sys.stdout, True)
|
features.pilinfo(sys.stdout, False)
|
||||||
|
|
||||||
# use doctest to make sure the test program behaves as documented!
|
# use doctest to make sure the test program behaves as documented!
|
||||||
import doctest
|
import doctest
|
||||||
|
|
|
@ -95,7 +95,7 @@ def get_supported():
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def pilinfo(out=None, brief=False):
|
def pilinfo(out=None, supported_formats=True):
|
||||||
if out is None:
|
if out is None:
|
||||||
out = sys.stdout
|
out = sys.stdout
|
||||||
|
|
||||||
|
@ -103,6 +103,10 @@ def pilinfo(out=None, brief=False):
|
||||||
|
|
||||||
print("-" * 68, file=out)
|
print("-" * 68, file=out)
|
||||||
print("Pillow {}".format(PIL.__version__), file=out)
|
print("Pillow {}".format(PIL.__version__), file=out)
|
||||||
|
py_version = sys.version.splitlines()
|
||||||
|
print("Python {}".format(py_version[0].strip()), file=out)
|
||||||
|
for py_version in py_version[1:]:
|
||||||
|
print(" {}".format(py_version.strip()), file=out)
|
||||||
print("-" * 68, file=out)
|
print("-" * 68, file=out)
|
||||||
print(
|
print(
|
||||||
"Python modules loaded from {}".format(os.path.dirname(Image.__file__)),
|
"Python modules loaded from {}".format(os.path.dirname(Image.__file__)),
|
||||||
|
@ -114,13 +118,6 @@ def pilinfo(out=None, brief=False):
|
||||||
)
|
)
|
||||||
print("-" * 68, file=out)
|
print("-" * 68, file=out)
|
||||||
|
|
||||||
if not brief:
|
|
||||||
v = sys.version.splitlines()
|
|
||||||
print("Python {}".format(v[0].strip()), file=out)
|
|
||||||
for v in v[1:]:
|
|
||||||
print(" {}".format(v.strip()), file=out)
|
|
||||||
print("-" * 68, file=out)
|
|
||||||
|
|
||||||
for name, feature in [
|
for name, feature in [
|
||||||
("pil", "PIL CORE"),
|
("pil", "PIL CORE"),
|
||||||
("tkinter", "TKINTER"),
|
("tkinter", "TKINTER"),
|
||||||
|
@ -135,7 +132,7 @@ def pilinfo(out=None, brief=False):
|
||||||
("zlib", "ZLIB (PNG/ZIP)"),
|
("zlib", "ZLIB (PNG/ZIP)"),
|
||||||
("libtiff", "LIBTIFF"),
|
("libtiff", "LIBTIFF"),
|
||||||
("raqm", "RAQM (Bidirectional Text)"),
|
("raqm", "RAQM (Bidirectional Text)"),
|
||||||
("libimagequant", "LIBIMAGEQUANT (quantization method)"),
|
("libimagequant", "LIBIMAGEQUANT (Quantization method)"),
|
||||||
]:
|
]:
|
||||||
if check(name):
|
if check(name):
|
||||||
print("---", feature, "support ok", file=out)
|
print("---", feature, "support ok", file=out)
|
||||||
|
@ -143,7 +140,7 @@ def pilinfo(out=None, brief=False):
|
||||||
print("***", feature, "support not installed", file=out)
|
print("***", feature, "support not installed", file=out)
|
||||||
print("-" * 68, file=out)
|
print("-" * 68, file=out)
|
||||||
|
|
||||||
if not brief:
|
if supported_formats:
|
||||||
extensions = collections.defaultdict(list)
|
extensions = collections.defaultdict(list)
|
||||||
for ext, i in Image.EXTENSION.items():
|
for ext, i in Image.EXTENSION.items():
|
||||||
extensions[i].append(ext)
|
extensions[i].append(ext)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user