def testExpectedOutput( self ) :

		def __test( fileName, size, filter ) :

			inputFileName = os.path.dirname( __file__ ) + "/images/" + fileName

			reader = GafferImage.ImageReader()
			reader["fileName"].setValue( inputFileName )

			resample = GafferImage.Resample()
			resample["in"].setInput( reader["out"] )
			resample["dataWindow"].setValue( IECore.Box2f( IECore.V2f( 0 ), IECore.V2f( size.x, size.y ) ) )
			resample["filter"].setValue( filter )
			resample["boundingMode"].setValue( GafferImage.Sampler.BoundingMode.Clamp )

			crop = GafferImage.Crop()
			crop["in"].setInput( resample["out"] )
			crop["area"].setValue( IECore.Box2i( IECore.V2i( 0 ), size ) )

			outputFileName = self.temporaryDirectory() + "/%s_%dx%d_%s.exr" % ( os.path.splitext( fileName )[0], size.x, size.y, filter )
			writer = GafferImage.ImageWriter()
			writer["in"].setInput( crop["out"] )
			writer["fileName"].setValue( outputFileName )
			writer["task"].execute()

			result = GafferImage.ImageReader()
			result["fileName"].setValue( writer["fileName"].getValue() )

			expected = GafferImage.ImageReader()
			expected["fileName"].setValue(
				"%s/images/%s_%dx%d_%s.exr" % (
					os.path.dirname( __file__ ),
					os.path.splitext( fileName )[0],
					size.x,
					size.y,
					filter
				)
			)

			self.assertImagesEqual( result["out"], expected["out"], maxDifference = 0.0005, ignoreMetadata = True )

			# Enable to write out images for visual comparison with OIIO.
			# The images will appear in a "resampleComparison" subdirectory
			# of the current directory.
			if False :

				if not os.path.exists( "resampleComparison" ) :
					os.makedirs( "resampleComparison" )

				shutil.copyfile( outputFileName, "resampleComparison/gaffer_" + os.path.basename( outputFileName ) )

				oiioOutputFileName = ( os.path.splitext( fileName )[0], size.x, size.y, filter ) % "resampleComparison/oiio_%s_%dx%d_%s.exr"

				subprocess.check_call(
					"oiiotool --threads 1 %s --ch R,G,B --resize:filter=%s %dx%d  -o %s" %
					(
						inputFileName,
						filter,
						size.x, size.y,
						oiioOutputFileName
					),
					shell = True
				)

		tests = [
			( "resamplePatterns.exr", IECore.V2i( 4 ), "lanczos3" ),
			( "resamplePatterns.exr", IECore.V2i( 40 ), "box" ),
			( "resamplePatterns.exr", IECore.V2i( 101 ), "gaussian" ),
			( "resamplePatterns.exr", IECore.V2i( 119 ), "mitchell" ),
		]

		for args in tests :
			__test( *args )
dataset/ETHPy150Open ImageEngine/gaffer/python/GafferImageTest/ResampleTest.py/ResampleTest.testExpectedOutput/swapped operands of `%`