Beispiel #1
0
 def test_unicode_to_unicode(self):
     entry = module.Entry(dict(text=u'szőlőfeldolgozó üzem'),
                          Template('{{text}}'))
     self.assertEqual(entry.render(), u'szőlőfeldolgozó üzem')
Beispiel #2
0
 def test_document_renders_entries(self):
     entry = module.Entry({}, Template('An entry.'))
     document = module.Document(
         [entry] * 3,
         Template('{% for entry in entries %}{{entry}}{% endfor %}'))
     self.assertEqual(str(document), 'An entry.An entry.An entry.')
Beispiel #3
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', render=4), Template(''))
Beispiel #4
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', apply_all_filters=4),
                          Template(''))
Beispiel #5
0
 def test_field_can_be_reached_directly(self):
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''))
     self.assertEqual(entry.b, '4')
Beispiel #6
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''))
     print entry.c
Beispiel #7
0
 def test_filters_applied_before_rendering(self):
     entry = module.Entry(dict(a='123', b=4), Template('{{a}}'),
                          dict(a=['append:4']))
     self.assertEqual(entry.render(), '1234')
Beispiel #8
0
 def test_filters_not_applied_twice(self):
     entry = module.Entry(dict(a='123', b=4), Template(''),
                          dict(a=['append:4']))
     entry.apply_all_filters()
     entry.apply_all_filters()
     self.assertEqual(entry.fields['a'], '1234')
Beispiel #9
0
 def callable():
     entry = module.Entry(dict(a=1), Template(''), dict(b=['split']))
Beispiel #10
0
 def test_filters_are_optional(self):
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''))
     entry.apply_all_filters()
     self.assertEqual(entry.fields['a'], '1, 2, 3')
Beispiel #11
0
 def test_filter_does_not_change_other_field(self):
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''),
                          dict(a=['split']))
     entry.apply_all_filters()
     self.assertEqual(entry.fields['b'], 4)
Beispiel #12
0
 def test_filter_knownvalues(self):
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''),
                          dict(a=['split']))
     entry.apply_all_filters()
     self.assertListEqual(entry.fields['a'], ['1', '2', '3'])
Beispiel #13
0
 def test_known_examples(self):
     entry = module.Entry(dict(x=1), Template('Value is {{x}}'))
     self.assertEqual(str(entry), 'Value is 1')
Beispiel #14
0
 def test_entry_as_string(self):
     entry = module.Entry({}, Template('Dummy template'))
     self.assertEqual(str(entry), 'Dummy template')
Beispiel #15
0
 def test_entry_accepts_none(self):
     entry = module.Entry({})