From 199a1c761960f1928d8ce80d607f6eedadc67957 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 19 Nov 2010 18:19:34 +0000 Subject: TEST: Make cxxtest work with Python 3.1 too. svn-id: r54387 --- test/cxxtest/cxxtestgen.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/cxxtest') diff --git a/test/cxxtest/cxxtestgen.py b/test/cxxtest/cxxtestgen.py index 831d23ab41..4145c3ca3e 100755 --- a/test/cxxtest/cxxtestgen.py +++ b/test/cxxtest/cxxtestgen.py @@ -57,7 +57,7 @@ def main(): def usage( problem = None ): '''Print usage info and exit''' if problem is None: - print usageString() + print( usageString() ) sys.exit(0) else: sys.stderr.write( usageString() ) @@ -82,7 +82,7 @@ def parseCommandline(): 'error-printer', 'abort-on-fail', 'have-std', 'no-std', 'have-eh', 'no-eh', 'template=', 'include=', 'root', 'part', 'no-static-init', 'factor', 'longlong='] ) - except getopt.error, problem: + except getopt.error as problem: usage( problem ) setOptions( options ) return setFiles( patterns ) @@ -315,7 +315,7 @@ def scanLineForDestroy( suite, lineNo, line ): def cstr( str ): '''Convert a string to its C representation''' - return '"' + string.replace( str, '\\', '\\\\' ) + '"' + return '"' + str.replace( '\\', '\\\\' ) + '"' def addSuiteCreateDestroy( suite, which, line ): @@ -335,10 +335,10 @@ def closeSuite(): def verifySuite(suite): '''Verify current suite is legal''' - if suite.has_key('create') and not suite.has_key('destroy'): + if 'create' in suite and not 'destroy' in suite: abort( '%s:%s: Suite %s has createSuite() but no destroySuite()' % (suite['file'], suite['create'], suite['name']) ) - if suite.has_key('destroy') and not suite.has_key('create'): + if 'destroy' in suite and not 'create' in suite: abort( '%s:%s: Suite %s has destroySuite() but no createSuite()' % (suite['file'], suite['destroy'], suite['name']) ) @@ -474,7 +474,7 @@ def isGenerated(suite): def isDynamic(suite): '''Checks whether a suite is dynamic''' - return suite.has_key('create') + return 'create' in suite lastIncluded = '' def writeInclude(output, file): -- cgit v1.2.3