From e53ab342686b8a577f9231d91fe3578cbbd6641a Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Thu, 20 May 2010 05:03:44 +0000 Subject: Convert old-style classes in test scripts to new-style classes. --- test/Actions/actions.py | 2 +- test/CPPPATH/expand-object.py | 2 +- test/CPPPATH/list-expansion.py | 2 +- test/Progress/object.py | 2 +- test/ToolSurrogate.py | 4 ++-- test/Value.py | 7 ++++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/Actions/actions.py b/test/Actions/actions.py index 1837ee7..03d67a0 100644 --- a/test/Actions/actions.py +++ b/test/Actions/actions.py @@ -86,7 +86,7 @@ test.up_to_date(arguments = '.') test.write('SConstruct', """ import os assert 'string' not in globals() -class bld: +class bld(object): def __init__(self): self.cmd = r'%(_python_)s build.py %%s 4 %%s' def __call__(self, env, target, source): diff --git a/test/CPPPATH/expand-object.py b/test/CPPPATH/expand-object.py index 54e1d39..8c811b7 100644 --- a/test/CPPPATH/expand-object.py +++ b/test/CPPPATH/expand-object.py @@ -34,7 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """ -class XXX: +class XXX(object): def __init__(self, value): self.value = value def __str__(self): diff --git a/test/CPPPATH/list-expansion.py b/test/CPPPATH/list-expansion.py index 98817b9..cec333d 100644 --- a/test/CPPPATH/list-expansion.py +++ b/test/CPPPATH/list-expansion.py @@ -42,7 +42,7 @@ test = TestSCons.TestSCons() test.subdir('sub1', 'sub2', 'sub3', 'sub4') test.write('SConstruct', """\ -class _inc_test: +class _inc_test(object): def __init__(self, name): self.name = name diff --git a/test/Progress/object.py b/test/Progress/object.py index 25c53cf..2886d06 100644 --- a/test/Progress/object.py +++ b/test/Progress/object.py @@ -36,7 +36,7 @@ test.write('SConstruct', """\ import sys env = Environment() env['BUILDERS']['C'] = Builder(action=Copy('$TARGET', '$SOURCE')) -class my_progress: +class my_progress(object): count = 0 def __call__(self, node, *args, **kw): self.count = self.count + 1 diff --git a/test/ToolSurrogate.py b/test/ToolSurrogate.py index a343d62..c62128f 100644 --- a/test/ToolSurrogate.py +++ b/test/ToolSurrogate.py @@ -34,7 +34,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -class Curry: +class Curry(object): def __init__(self, fun, *args, **kwargs): self.fun = fun self.pending = args[:] @@ -55,7 +55,7 @@ def Str(target, source, env, cmd=""): result.append(" ".join(map(str, cmd))) return '\\n'.join(result) -class ToolSurrogate: +class ToolSurrogate(object): def __init__(self, tool, variable, func): self.tool = tool self.variable = variable diff --git a/test/Value.py b/test/Value.py index 72a43fa..06cce40 100644 --- a/test/Value.py +++ b/test/Value.py @@ -38,7 +38,7 @@ python = TestSCons.python SConstruct_content = """ Decider(r'%(source_signature)s') -class Custom: +class Custom(object): def __init__(self, value): self.value = value def __str__(self): return "C=" + str(self.value) @@ -93,10 +93,11 @@ for source_signature in ['MD5', 'timestamp-newer']: out1 = """create(["f1.out"], ['/usr/local'])""" out2 = """create(["f2.out"], [10])""" - out3 = """create\\(\\["f3.out"\\], \\[<.*.Custom instance at """ + out3 = """create\\(\\["f3.out"\\], \\[<.*.Custom (instance|object) at """ #" <- unconfuses emacs syntax highlighting test.must_contain_all_lines(test.stdout(), [out1, out2, out7, out8]) + print test.stdout() test.fail_test(re.search(out3, test.stdout()) == None) test.must_match('f1.out', "/usr/local") @@ -110,7 +111,7 @@ for source_signature in ['MD5', 'timestamp-newer']: test.run(arguments='prefix=/usr') out4 = """create(["f1.out"], ['/usr'])""" out5 = """create(["f2.out"], [4])""" - out6 = """create\\(\\["f3.out"\\], \\[<.*.Custom instance at """ + out6 = """create\\(\\["f3.out"\\], \\[<.*.Custom (instance|object) at """ #" <- unconfuses emacs syntax highlighting test.must_contain_all_lines(test.stdout(), [out4, out5]) test.fail_test(re.search(out6, test.stdout()) == None) -- cgit v0.12