diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 14:28:22 +0000 |
commit | 738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (patch) | |
tree | 0397d9bf3b12c903dc73419585df231397ff343c /src/engine/SCons/Variables/VariablesTests.py | |
parent | e7885e3af440eaef38a9301fd92a105afc8ddebb (diff) |
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'src/engine/SCons/Variables/VariablesTests.py')
-rw-r--r-- | src/engine/SCons/Variables/VariablesTests.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py index 617cf8f..7ecbc0d 100644 --- a/src/engine/SCons/Variables/VariablesTests.py +++ b/src/engine/SCons/Variables/VariablesTests.py @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/VariablesTests.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/Variables/VariablesTests.py 5023 2010/06/14 22:05:46 scons" import sys import unittest @@ -32,7 +32,7 @@ import SCons.Subst import SCons.Warnings -class Environment: +class Environment(object): def __init__(self): self.dict = {} def subst(self, x): @@ -41,8 +41,10 @@ class Environment: self.dict[key] = value def __getitem__(self, key): return self.dict[key] + def __contains__(self, key): + return self.dict.__contains__(key) def has_key(self, key): - return self.dict.has_key(key) + return key in self.dict def check(key, value, env): @@ -68,7 +70,7 @@ class VariablesTestCase(unittest.TestCase): "42", check, lambda x: int(x) + 12) - keys = opts.keys() + keys = list(opts.keys()) assert keys == ['VAR1', 'VAR2'], keys def test_Add(self): @@ -253,7 +255,7 @@ class VariablesTestCase(unittest.TestCase): env = Environment() opts.Update(env, {}) - assert not env.has_key('ANSWER') + assert 'ANSWER' not in env # Test that a default value of None is all right. test = TestSCons.TestSCons() @@ -267,7 +269,7 @@ class VariablesTestCase(unittest.TestCase): env = Environment() opts.Update(env, {}) - assert not env.has_key('ANSWER') + assert 'ANSWER' not in env def test_args(self): """Test updating an Environment with arguments overridden""" @@ -378,7 +380,7 @@ class VariablesTestCase(unittest.TestCase): 'OPT_BOOL_2' : 2}) # Test against some old bugs - class Foo: + class Foo(object): def __init__(self, x): self.x = x def __str__(self): @@ -527,12 +529,12 @@ B 42 54 b - alpha test ['B'] env = Environment() opts.Update(env, {'ANSWER' : 'answer'}) - assert env.has_key('ANSWER') + assert 'ANSWER' in env env = Environment() opts.Update(env, {'ANSWERALIAS' : 'answer'}) - assert env.has_key('ANSWER') and not env.has_key('ANSWERALIAS') + assert 'ANSWER' in env and 'ANSWERALIAS' not in env # test alias as a list opts = SCons.Variables.Variables() @@ -545,12 +547,12 @@ B 42 54 b - alpha test ['B'] env = Environment() opts.Update(env, {'ANSWER' : 'answer'}) - assert env.has_key('ANSWER') + assert 'ANSWER' in env env = Environment() opts.Update(env, {'ANSWERALIAS' : 'answer'}) - assert env.has_key('ANSWER') and not env.has_key('ANSWERALIAS') + assert 'ANSWER' in env and 'ANSWERALIAS' not in env @@ -652,7 +654,7 @@ if __name__ == "__main__": UnknownVariablesTestCase ] for tclass in tclasses: names = unittest.getTestCaseNames(tclass, 'test_') - suite.addTests(map(tclass, names)) + suite.addTests(list(map(tclass, names))) if not unittest.TextTestRunner().run(suite).wasSuccessful(): sys.exit(1) |