- Add a Clean() method to support removing user-specified targets
when using the -c option.
+ From Lachlan O'Dea:
+
+ - Make the Environment.get() method return None by default.
+
From Anthony Roach:
- Add SetJobs() and GetJobs() methods to allow configuration of the
else:
return self
- def get(self, key, default):
+ def get(self, key, default=None):
"Emulates the get() method of dictionaries."""
return self._dict.get(key, default)
assert env['TOOL2'] == 222, env
assert env['AAA'] == 'aaa', env
+ def test_get(self):
+ """Test the get() method."""
+ env = Environment(aaa = 'AAA')
+
+ x = env.get('aaa')
+ assert x == 'AAA', x
+ x = env.get('aaa', 'XXX')
+ assert x == 'AAA', x
+ x = env.get('bbb')
+ assert x is None, x
+ x = env.get('bbb', 'XXX')
+ assert x == 'XXX', x
+
if __name__ == "__main__":
suite = unittest.makeSuite(EnvironmentTestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():