diff --git a/test/test_parameter.py b/test/test_parameter.py index e5d4e9f..c5d8e59 100644 --- a/test/test_parameter.py +++ b/test/test_parameter.py @@ -1,6 +1,6 @@ import unittest -from wireup.ioc.container_util import ParameterWrapper +from wireup.ioc.container_util import ParameterWrapper, ParameterReference from wireup.ioc.parameter import ParameterBag, TemplatedString @@ -44,6 +44,12 @@ def test_all(self): self.assertEqual(self.bag.get_all(), {"foo": "bar", "bar": "baz", "baz": "qux"}) + def test_parameter_interpolation_is_cached(self): + self.bag.put("foo", "bar") + self.assertEqual(self.bag.get(TemplatedString("${foo}-${foo}")), "bar-bar") + self.assertEqual(self.bag.get(TemplatedString("${foo}-${foo}")), "bar-bar") + self.assertEqual(self.bag._ParameterBag__cache, {"${foo}-${foo}": "bar-bar"}) # noqa: SLF001 + class TestParameterPlaceholder(unittest.TestCase): def test_init(self):