summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-06-04 10:07:13 +0200
committeralalazo <massimiliano.culpo@googlemail.com>2016-06-04 10:07:13 +0200
commit0e71b5dde8fb8c235122b16368cb075a35be9bfb (patch)
tree64cb2303746ef221654986cae7ee3e4b2111ee7f /lib
parent561a4fbeeaf6d01d323ab2ee0bd4d0b1938462e4 (diff)
downloadspack-0e71b5dde8fb8c235122b16368cb075a35be9bfb.tar.gz
spack-0e71b5dde8fb8c235122b16368cb075a35be9bfb.tar.bz2
spack-0e71b5dde8fb8c235122b16368cb075a35be9bfb.tar.xz
spack-0e71b5dde8fb8c235122b16368cb075a35be9bfb.zip
unit test : update dictionary extending lists
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/modules.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py
index c73badf8f2..0465c3e67f 100644
--- a/lib/spack/spack/test/modules.py
+++ b/lib/spack/spack/test/modules.py
@@ -27,6 +27,7 @@ from contextlib import contextmanager
import StringIO
import spack.modules
+import unittest
from spack.test.mock_packages_test import MockPackagesTest
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
@@ -100,6 +101,33 @@ configuration_conflicts = {
}
}
+class HelperFunctionsTests(unittest.TestCase):
+ def test_update_dictionary_extending_list(self):
+ target = {
+ 'foo': {
+ 'a': 1,
+ 'b': 2,
+ 'd': 4
+ },
+ 'bar': [1, 2, 4],
+ 'baz': 'foobar'
+ }
+ update = {
+ 'foo': {
+ 'c': 3,
+ },
+ 'bar': [3],
+ 'baz': 'foobaz',
+ 'newkey': {
+ 'd': 4
+ }
+ }
+ spack.modules.update_dictionary_extending_lists(target, update)
+ self.assertTrue(len(target) == 4)
+ self.assertTrue(len(target['foo']) == 4)
+ self.assertTrue(len(target['bar']) == 4)
+ self.assertEqual(target['baz'], 'foobaz')
+
class TclTests(MockPackagesTest):
def setUp(self):