summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-24 05:51:13 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-04-24 05:51:13 (GMT)
commit7e116b31182749950856c622ca7932031f8be19c (patch)
treea4b9f900e52561a91e0c4509dc6c692492996b7f /src/engine/SCons/EnvironmentTests.py
parent591b78f0f314f11192fdf13d3baa66f81b160e44 (diff)
downloadSCons-7e116b31182749950856c622ca7932031f8be19c.zip
SCons-7e116b31182749950856c622ca7932031f8be19c.tar.gz
SCons-7e116b31182749950856c622ca7932031f8be19c.tar.bz2
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Comb out all code that supported earlier versions of Python. Most such code is in snippets of only a few lines and can be identified by having a Python version string in it. Such snippets add up; this combing pass probably got rid of over 500 lines of code.
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py68
1 files changed, 17 insertions, 51 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index ddaa2ef..ce4e040 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -234,17 +234,9 @@ class SubstitutionTestCase(unittest.TestCase):
def test_contains(self):
"""Test the SubstitutionEnvironment __contains__() method
"""
- try:
- 'x' in {'x':1}
- except TypeError:
- # TODO(1.5)
- # An early version of Python that doesn't support "in"
- # on dictionaries. Just pass the test.
- pass
- else:
- env = SubstitutionEnvironment(XXX = 'x')
- assert 'XXX' in env
- assert not 'YYY' in env
+ env = SubstitutionEnvironment(XXX = 'x')
+ assert 'XXX' in env
+ assert not 'YYY' in env
def test_items(self):
"""Test the SubstitutionEnvironment items() method
@@ -1706,17 +1698,8 @@ def exists(env):
env['CLVar'] = CLVar([])
env.AppendUnique(CLVar = 'bar')
result = env['CLVar']
- if sys.version[0] == '1' or sys.version[:3] == '2.0':
- # Python 2.0 and before have a quirky behavior where CLVar([])
- # actually matches '' and [] due to different __coerce__()
- # semantics in the UserList implementation. It isn't worth a
- # lot of effort to get this corner case to work identically
- # (support for Python 1.5 support will die soon anyway),
- # so just treat it separately for now.
- assert result == 'bar', result
- else:
- assert isinstance(result, CLVar), repr(result)
- assert result == ['bar'], result
+ assert isinstance(result, CLVar), repr(result)
+ assert result == ['bar'], result
env['CLVar'] = CLVar(['abc'])
env.AppendUnique(CLVar = 'bar')
@@ -2356,17 +2339,8 @@ f5: \
env['CLVar'] = CLVar([])
env.PrependUnique(CLVar = 'bar')
result = env['CLVar']
- if sys.version[0] == '1' or sys.version[:3] == '2.0':
- # Python 2.0 and before have a quirky behavior where CLVar([])
- # actually matches '' and [] due to different __coerce__()
- # semantics in the UserList implementation. It isn't worth a
- # lot of effort to get this corner case to work identically
- # (support for Python 1.5 support will die soon anyway),
- # so just treat it separately for now.
- assert result == 'bar', result
- else:
- assert isinstance(result, CLVar), repr(result)
- assert result == ['bar'], result
+ assert isinstance(result, CLVar), repr(result)
+ assert result == ['bar'], result
env['CLVar'] = CLVar(['abc'])
env.PrependUnique(CLVar = 'bar')
@@ -3624,24 +3598,16 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture):
def test_contains(self):
"""Test the OverrideEnvironment __contains__() method"""
- try:
- 'x' in {'x':1}
- except TypeError:
- # TODO(1.5)
- # An early version of Python that doesn't support "in"
- # on dictionaries. Just pass the test.
- pass
- else:
- env, env2, env3 = self.envs
- assert 'XXX' in env
- assert 'XXX' in env2
- assert 'XXX' in env3
- assert 'YYY' in env
- assert 'YYY' in env2
- assert 'YYY' in env3
- assert not 'ZZZ' in env
- assert not 'ZZZ' in env2
- assert 'ZZZ' in env3
+ env, env2, env3 = self.envs
+ assert 'XXX' in env
+ assert 'XXX' in env2
+ assert 'XXX' in env3
+ assert 'YYY' in env
+ assert 'YYY' in env2
+ assert 'YYY' in env3
+ assert not 'ZZZ' in env
+ assert not 'ZZZ' in env2
+ assert 'ZZZ' in env3
def test_items(self):
"""Test the OverrideEnvironment Dictionary() method"""