diff options
author | eugue <eug.sun@gmail.com> | 2011-02-12 20:09:41 -0500 |
---|---|---|
committer | eugue <eug.sun@gmail.com> | 2011-02-12 20:09:41 -0500 |
commit | 1e8b07e52c8b15b9bf4d9dc357f56bc8bbccc718 (patch) | |
tree | cb80c07023d8f4781d95e23f989976093f7c9d5d /tests/TestConfigLoaders.py | |
parent | 9e342041f05e88f8d1987a48fdcdc10c14ef095f (diff) | |
parent | a239c7accdc634459d2db014b8d8b6d5b78bab1b (diff) |
Merge branch 'master' of github.com:rcoh/SmootLight into behavior-factory
Diffstat (limited to 'tests/TestConfigLoaders.py')
-rw-r--r-- | tests/TestConfigLoaders.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/TestConfigLoaders.py b/tests/TestConfigLoaders.py index c79bbf1..02c8865 100644 --- a/tests/TestConfigLoaders.py +++ b/tests/TestConfigLoaders.py @@ -29,6 +29,20 @@ class TestConfigLoaders(unittest.TestCase): result.write('tests/testdata/inheritanceTESTout.xml') assert filecmp.cmp('tests/testdata/inheritanceTESTout.xml',\ 'tests/testdata/inheritanceTRUTH.xml') + #Tests our fancy new XML Eval Function + def test_eval(self): + assert Config.attemptEval('5') == 5 + assert Config.attemptEval('{5:10, 12:15}') == {5:10, 12:15} + singleLayerLambda = Config.attemptEval('${Val}$*5') + assert singleLayerLambda({'Val':2}) == 10 + doubleLayerLambda = Config.attemptEval("${Val1}$*'${Val2}$'") + assert doubleLayerLambda({'Val1':3})({'Val2':7}) == 21 + conditional = Config.attemptEval("${Val1}$*5=='${Val2}$'") + assert conditional({'Val1':5})({'Val2':25}) == True + assert conditional({'Val1':5})({'Val2':26}) == False + + onlyDouble = Config.attemptEval("'${Val1}$'*'${Val2}$'") + assert onlyDouble({})({'Val1':3, 'Val2':7}) == 21 if __name__ == '__main__': unittest.main() |