test_parse_inline_template.py 631 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo.tests import BaseCase
  4. from odoo.tools.rendering_tools import parse_inline_template
  5. class TestParseInlineTemplate(BaseCase):
  6. def test_no_expression(self):
  7. text = 'a b c'
  8. self.assertEqual(parse_inline_template(text), [('a b c', '')])
  9. def test_expression1(self):
  10. text = 'a {{b}}'
  11. self.assertEqual(parse_inline_template(text), [('a ', 'b')])
  12. def test_expression2(self):
  13. text = 'a {{b}} c'
  14. self.assertEqual(parse_inline_template(text), [('a ', 'b'), (' c', '')])