From 980517587db21fb40b5e73cd0a6bc049bfc38b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Tue, 7 Jan 2014 21:24:21 -0500 Subject: [PATCH] MAINT: use is instead of == for True, False, None --- PIL/SpiderImagePlugin.py | 2 +- Tests/cms_test.py | 20 ++++++++++---------- Tests/test_file_eps.py | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/PIL/SpiderImagePlugin.py b/PIL/SpiderImagePlugin.py index 9e814932d..cd97c524d 100644 --- a/PIL/SpiderImagePlugin.py +++ b/PIL/SpiderImagePlugin.py @@ -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 = [] diff --git a/Tests/cms_test.py b/Tests/cms_test.py index 634e3f717..1bd406ca9 100644 --- a/Tests/cms_test.py +++ b/Tests/cms_test.py @@ -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()) diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py index f9e1702ef..f9f781dd6 100644 --- a/Tests/test_file_eps.py +++ b/Tests/test_file_eps.py @@ -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: