def test_replace_with_unicode(self):
     editor.rereplace('Here|With', u'XäöüY')
     text = editor.getText()
     self.assertEqual(
         text,
         u'XäöüY is some text\r\nXäöüY some umlauts XäXüXö\r\n'.encode(
             'windows-1252'))
示例#2
0
 def test_replace_function(self):
     editor.rereplace(r'([a-z]+)([0-9]+)'.encode('windows-1252'),
                      group2_with_counter)
     text = editor.getText()
     self.assertEqual(
         text,
         u'1231 54322 983\r\nä1234 ü54325 ö986\r\n'.encode('windows-1252'))
 def test_unicode_replace(self):
     editor.rereplace(u'X[äö]', 'PP')
     text = editor.getText()
     self.assertEqual(
         text, u'Here is some text\r\nWith some umlauts PPXüPP\r\n'.encode(
             'windows-1252'))
 def test_ansi_replace(self):
     editor.rereplace(u'X[äö]'.encode('windows-1252'), 'YY')
     text = editor.getText()
     self.assertEqual(
         text, u'Here is some text\r\nWith some umlauts YYXüYY\r\n'.encode(
             'windows-1252'))
 def test_simple_replace(self):
     editor.rereplace(r'some\s([a-z]+)', 'TEST')
     text = editor.getText()
     self.assertEqual(
         text,
         u'Here is TEST\r\nWith TEST XäXüXö\r\n'.encode('windows-1252'))