source: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_utils.py @ 10021

Last change on this file since 10021 was 7510, checked in by uli, 13 years ago

Add tests for extended formatted_text helper function.

File size: 1022 bytes
Line 
1# -*- coding: utf-8 -*-
2import unittest
3from waeup.sirp.students.utils import formatted_text
4
5class FormatterTests(unittest.TestCase):
6
7    def test_formatted_text(self):
8        # we can format strings, unicode and things convertable to unicode.
9        result1 = formatted_text('sample')
10        result2 = formatted_text('ümlaut')
11        result3 = formatted_text(3)
12        result4 = formatted_text(u'unicöde')
13        result5 = formatted_text(u'sample', color='red', size=12)
14        self.assertTrue(isinstance(result1, unicode))
15        self.assertEqual(
16            result1, u'<font color="black" size="10">sample</font>')
17        self.assertEqual(
18            result2, u'<font color="black" size="10">ümlaut</font>')
19        self.assertEqual(
20            result3, u'<font color="black" size="10">3</font>')
21        self.assertEqual(
22            result4, u'<font color="black" size="10">unicöde</font>')
23        self.assertEqual(
24            result5, u'<font color="red" size="12">sample</font>')
25        return
Note: See TracBrowser for help on using the repository browser.