def main(): 'SCript entry point' vars_ = {} for fname in sys.argv[1:]: current = load(open(fname).read()) generate.merge(vars_, current) sys.stdout.write(dump(vars_))
def test_merge_lists(self): dic1 = {'a': [1, 2]} dic2 = {'a': [3, 4]} generate.merge(dic1, dic2) self.assertEqual(dic1['a'], [1, 2, 3, 4])
def test_merge_subdict(self): dic1 = {'a': {'b': 2}} dic2 = {'a': {'c': 3}} generate.merge(dic1, dic2) self.assertEqual(dic1['a']["c"], 3)
def test_merge_identical(self): dic1 = {'a': 1} dic2 = {'a': 2} generate.merge(dic1, dic2) self.assertEqual(dic1['a'], 2)
def test_merge(self): dic1 = {'a': 1} dic2 = {'b': 2} generate.merge(dic1, dic2) self.assertEqual(dic1['b'], 2)