Beispiel #1
0
 def test_deep_subst_solo(self):
     var = PARAMETER_INTERPOLATION_DELIMITER.join(('motd', 'greeting'))
     s = _var(var)
     tv = Value(s)
     self.assertTrue(tv.has_references())
     self.assertEqual(
         tv.render(CONTEXT, None),
         _poor_mans_template(s, var, CONTEXT['motd']['greeting']))
Beispiel #2
0
 def test_multiple_subst(self):
     greet = PARAMETER_INTERPOLATION_DELIMITER.join(('motd', 'greeting'))
     s = _var(greet) + ' I like ' + _var('favcolour') + '!'
     tv = RefValue(s)
     self.assertTrue(tv.has_references())
     want = _poor_mans_template(s, greet, CONTEXT['motd']['greeting'])
     want = _poor_mans_template(want, 'favcolour', CONTEXT['favcolour'])
     self.assertEqual(tv.render(CONTEXT), want)
Beispiel #3
0
 def test_multiple_subst_flush(self):
     greet = PARAMETER_INTERPOLATION_DELIMITER.join(('motd', 'greeting'))
     s = _var(greet) + ' I like ' + _var('favcolour')
     tv = Value(s)
     self.assertTrue(tv.has_references())
     want = _poor_mans_template(s, greet, CONTEXT['motd']['greeting'])
     want = _poor_mans_template(want, 'favcolour', CONTEXT['favcolour'])
     self.assertEqual(tv.render(CONTEXT, None), want)
Beispiel #4
0
 def test_deep_subst_solo(self):
     var = PARAMETER_INTERPOLATION_DELIMITER.join(('motd', 'greeting'))
     s = _var(var)
     tv = RefValue(s)
     self.assertTrue(tv.has_references())
     self.assertEqual(tv.render(CONTEXT),
                      _poor_mans_template(s, var,
                                          CONTEXT['motd']['greeting']))