summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Variables/VariablesTests.py
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:28 +0000
committerLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:28 +0000
commit0ed55e71a9f4b9cda836c6a4a5408cece60db0c6 (patch)
treeb1e82f6e428ac15ed9b4de93e48d8079420d537d /src/engine/SCons/Variables/VariablesTests.py
parentfe00e4f75ba00298c30d6854b245c2a42c6542b8 (diff)
parent738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (diff)
Merge commit 'upstream/2.0.0'
Diffstat (limited to 'src/engine/SCons/Variables/VariablesTests.py')
-rw-r--r--src/engine/SCons/Variables/VariablesTests.py26
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)