MAINT: use is instead of == for True, False, None

This commit is contained in:
François Boulogne 2014-01-07 21:24:21 -05:00
parent 923018dfeb
commit 980517587d
3 changed files with 14 additions and 14 deletions

View File

@ -182,7 +182,7 @@ class SpiderImageFile(ImageFile.ImageFile):
# given a list of filenames, return a list of images
def loadImageSeries(filelist=None):
" create a list of Image.images for use in montage "
if filelist == None or len(filelist) < 1:
if filelist is None or len(filelist) < 1:
return
imglist = []

View File

@ -47,7 +47,7 @@ TEST_misc = False
#######################################################################
def outputImage(im, funcName = None):
# save or display the image, depending on value of SHOW_IMAGES
if SHOW == True:
if SHOW is True:
im.show()
else:
im.save(os.path.join(OUTPUTDIR, "%s.tif" %funcName))
@ -57,7 +57,7 @@ def outputImage(im, funcName = None):
# The tests themselves
#######################################################################
if TEST_error_catching == True:
if TEST_error_catching is True:
im = Image.open(IMAGE)
try:
#neither of these proifles exists (unless you make them), so we should
@ -70,7 +70,7 @@ if TEST_error_catching == True:
print("error catching test completed successfully (if you see the message \
above that we caught the error).")
if TEST_profileToProfile == True:
if TEST_profileToProfile is True:
# open the image file using the standard PIL function Image.open()
im = Image.open(IMAGE)
@ -84,7 +84,7 @@ if TEST_profileToProfile == True:
print("profileToProfile test completed successfully.")
if TEST_profileToProfile_inPlace == True:
if TEST_profileToProfile_inPlace is True:
# we'll do the same test as profileToProfile, but modify im in place
# instead of getting a new image returned to us
im = Image.open(IMAGE)
@ -94,7 +94,7 @@ if TEST_profileToProfile_inPlace == True:
outputMode = OUTMODE, inPlace = True)
# now that the image is converted, save or display it
if result == None:
if result is None:
# this is the normal result when modifying in-place
outputImage(im, "profileToProfile_inPlace")
else:
@ -103,7 +103,7 @@ if TEST_profileToProfile_inPlace == True:
print("profileToProfile in-place test completed successfully.")
if TEST_buildTransform == True:
if TEST_buildTransform is True:
# make a transform using the input and output profile path strings
transform = ImageCms.buildTransform(INPUT_PROFILE, OUTPUT_PROFILE, INMODE, \
OUTMODE)
@ -126,7 +126,7 @@ if TEST_buildTransform == True:
# Python should also do this automatically when it goes out of scope.
del(transform)
if TEST_buildTransformFromOpenProfiles == True:
if TEST_buildTransformFromOpenProfiles is True:
# we'll actually test a couple profile open/creation functions here too
# first, get a handle to an input profile, in this case we'll create
@ -160,7 +160,7 @@ if TEST_buildTransformFromOpenProfiles == True:
del(outputProfile)
del(transform)
if TEST_buildProofTransform == True:
if TEST_buildProofTransform is True:
# make a transform using the input and output and proof profile path
# strings
# images converted with this transform will simulate the appearance
@ -188,7 +188,7 @@ if TEST_buildProofTransform == True:
# Python should also do this automatically when it goes out of scope.
del(transform)
if TEST_getProfileInfo == True:
if TEST_getProfileInfo is True:
# get a profile handle
profile = ImageCms.getOpenProfile(INPUT_PROFILE)
@ -212,7 +212,7 @@ if TEST_getProfileInfo == True:
print("getProfileInfo test completed successfully.")
if TEST_misc == True:
if TEST_misc is True:
# test the versions, about, and copyright functions
print("Versions: %s" %str(ImageCms.versions()))
print("About:\n\n%s" %ImageCms.about())

View File

@ -3,10 +3,10 @@ from tester import *
from PIL import Image, EpsImagePlugin
import sys
if EpsImagePlugin.gs_windows_binary == False:
# already checked. Not there.
if EpsImagePlugin.gs_windows_binary is False:
# already checked. Not there.
skip()
if not sys.platform.startswith('win'):
import subprocess
try: