diff options
Diffstat (limited to 'tests/QtCore/qregexp_test.py')
-rw-r--r-- | tests/QtCore/qregexp_test.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/QtCore/qregexp_test.py b/tests/QtCore/qregexp_test.py new file mode 100644 index 000000000..54991854a --- /dev/null +++ b/tests/QtCore/qregexp_test.py @@ -0,0 +1,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() + |