def test_maptostr(self):
     assert socless_template_string("{context.unicodelist|maptostr}",
                                    self.context) == "{}".format(
                                        ['hello', 'world'])
 def test_unsafe_string(self):
     assert socless_template_string(
         "Hello {context.unsafe_string}", self.context
     ) == "Hello <script>alert('Elliot Alderson')</script>"
 def test_dictionary_reference(self):
     assert socless_template_string(
         "Hello {context.dict}", self.context
     ) == """Hello {'safe_string': 'Elliot Alderson', 'unsafe_string': "<script>alert('Elliot Alderson')</script>"}"""
 def test_safe_string(self):
     assert socless_template_string("Hello {context.safe_string}",
                                    self.context) == "Hello Elliot Alderson"