aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qregexp_test.py
blob: 54991854a62d28ee95ff92a7fa6de87c7f17b2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python

import unittest
from PySide.QtCore import QRegExp

class QRegExpTest(unittest.TestCase):

    def testReplace1(self):
        re = QRegExp('a[mn]')
        string = re.replace('Banana', 'ox')
        self.assertEqual(string, 'Boxoxa')

    def testReplace2(self):
        re = QRegExp('<i>([^<]*)</i>')
        string = re.replace('A <i>bon mot</i>.', '\\emph{\\1}')
        self.assertEqual(string, 'A \\emph{bon mot}.')

if __name__ == '__main__':
    unittest.main()