mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
More and better comments.
This commit is contained in:
parent
3507f502c9
commit
4455cd8e19
1 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
#! /usr/bin/env python
|
||||||
|
"""Simple test script for imgfile.c
|
||||||
|
Roger E. Masse
|
||||||
|
"""
|
||||||
from test_support import verbose
|
from test_support import verbose
|
||||||
|
|
||||||
import imgfile
|
import imgfile
|
||||||
|
@ -5,13 +9,16 @@ import imgfile
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
# Test a 3 byte color image
|
||||||
testimage('test.rgb')
|
testimage('test.rgb')
|
||||||
|
|
||||||
|
# Test a 1 byte greyscale image
|
||||||
testimage('greytest.rgb')
|
testimage('greytest.rgb')
|
||||||
|
|
||||||
|
|
||||||
def testimage(name):
|
def testimage(name):
|
||||||
"""return a tuple consisting of
|
"""Run through the imgfile's battery of possible methods
|
||||||
image (in 'imgfile' format) width, height, size
|
on the image passed in name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -22,8 +29,8 @@ def testimage(name):
|
||||||
|
|
||||||
# try opening the name directly
|
# try opening the name directly
|
||||||
try:
|
try:
|
||||||
# This function returns a tuple (x, y, z) where x and y are the size of
|
# This function returns a tuple (x, y, z) where x and y are the size
|
||||||
# the image in pixels and z is the number of bytes per pixel. Only
|
# of the image in pixels and z is the number of bytes per pixel. Only
|
||||||
# 3 byte RGB pixels and 1 byte greyscale pixels are supported.
|
# 3 byte RGB pixels and 1 byte greyscale pixels are supported.
|
||||||
sizes = imgfile.getsizes(name)
|
sizes = imgfile.getsizes(name)
|
||||||
except imgfile.error:
|
except imgfile.error:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue