def test_set_name(self): t = Template("{{t|a|a}}") t.name = ' u ' self.assertEqual("{{ u |a|a}}", t.string)
def test_extending_template_name_should_not_effect_arg_string(self): t = Template('{{t|1=2}}') a = t.arguments[0] t.name = 't\n ' self.assertEqual('|1=2', a.string)
def test_name_contains_a_param_with_default(self): t = Template('{{t {{{p1|d1}}} | {{{p2|d2}}} }}') self.assertEqual('t {{{p1|d1}}} ', t.name) self.assertEqual('| {{{p2|d2}}} ', t.arguments[0].string) t.name = 'g' self.assertEqual('g', t.name)
def test_stripping_template_name_should_update_its_arg_spans(self): t = Template('{{ t\n |1=2}}') a = t.arguments[0] t.name = t.name.strip(WS) self.assertEqual('|1=2', a.string)
def test_extending_template_name_should_not_effect_arg_string(): t = Template('{{t|1=2}}') a = t.arguments[0] t.name = 't\n ' assert '|1=2' == a.string
def test_stripping_template_name_should_update_its_arg_spans(): t = Template('{{ t\n |1=2}}') a = t.arguments[0] t.name = t.name.strip(WS) assert '|1=2' == a.string
def test_set_name(): t = Template("{{t|a|a}}") t.name = ' u ' assert "{{ u |a|a}}" == t.string
def test_name_contains_a_param_with_default(): t = Template('{{t {{{p1|d1}}} | {{{p2|d2}}} }}') assert 't {{{p1|d1}}} ' == t.name assert '| {{{p2|d2}}} ' == t.arguments[0].string t.name = 'g' assert 'g' == t.name