예제 #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')
예제 #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.')
예제 #3
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', render=4), Template(''))
예제 #4
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', apply_all_filters=4),
                          Template(''))
예제 #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')
예제 #6
0
 def callable():
     entry = module.Entry(dict(a='1, 2, 3', b=4), Template(''))
     print entry.c
예제 #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')
예제 #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')
예제 #9
0
 def callable():
     entry = module.Entry(dict(a=1), Template(''), dict(b=['split']))
예제 #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')
예제 #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)
예제 #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'])
예제 #13
0
 def test_known_examples(self):
     entry = module.Entry(dict(x=1), Template('Value is {{x}}'))
     self.assertEqual(str(entry), 'Value is 1')
예제 #14
0
 def test_entry_as_string(self):
     entry = module.Entry({}, Template('Dummy template'))
     self.assertEqual(str(entry), 'Dummy template')
예제 #15
0
 def test_entry_accepts_none(self):
     entry = module.Entry({})