# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
import mozunit from taskgraph.util.templates import merge, merge_to
class MergeTest(unittest.TestCase): def test_merge_to_dicts(self):
source = {"a": 1, "b": 2}
dest = {"b": "20", "c": 30}
expected = { "a": 1, # source only "b": 2, # source overrides dest "c": 30, # dest only
}
self.assertEqual(merge_to(source, dest), expected)
self.assertEqual(dest, expected)
def test_merge_to_lists(self):
source = {"x": [3, 4]}
dest = {"x": [1, 2]}
expected = {"x": [1, 2, 3, 4]} # dest first
self.assertEqual(merge_to(source, dest), expected)
self.assertEqual(dest, expected)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.