1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

wafsamba: Add tests for dict_concat.

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Feb 12 20:17:54 CET 2012 on sn-devel-104
This commit is contained in:
Jelmer Vernooij 2012-02-12 18:42:17 +01:00
parent a0fb7211cd
commit 2d66d16af0

View File

@ -18,6 +18,7 @@ from wafsamba.tests import TestCase
from wafsamba.samba_utils import (
TO_LIST,
dict_concat,
subst_vars_error,
unique_list,
)
@ -50,8 +51,26 @@ class UniqueListTests(TestCase):
class SubstVarsErrorTests(TestCase):
def test_valid(self):
self.assertEquals("", subst_vars_error(""))
self.assertEquals("", subst_vars_error("", {}))
self.assertEquals("FOO bar", subst_vars_error("${F} bar", {"F": "FOO"}))
def test_invalid(self):
self.assertRaises(KeyError, subst_vars_error, "${F}", {})
class DictConcatTests(TestCase):
def test_empty(self):
ret = {}
dict_concat(ret, {})
self.assertEquals({}, ret)
def test_same(self):
ret = {"foo": "bar"}
dict_concat(ret, {"foo": "bla"})
self.assertEquals({"foo": "bar"}, ret)
def test_simple(self):
ret = {"foo": "bar"}
dict_concat(ret, {"blie": "bla"})
self.assertEquals({"foo": "bar", "blie": "bla"}, ret)