def url(self, value): if isinstance(value, dict): # this is the templated url , we need to convert it into actual URL template_str = Parser.lowercase_keys(value)['template'] self.set_template("url", Parser.coerce_to_string(template_str)) self.__url = value else: self.__url = value
def test_coerce_to_string(self): result = Parser.coerce_to_string(bytes("Hello", 'utf-8')) self.assertEqual(result, "Hello")