1   
 2   
 3   
 4  from translate.filters import autocorrect 
 5   
 7   
 8 -    def correct(self, msgid, msgstr, expected): 
  9          """helper to run correct function from autocorrect module""" 
10          corrected = autocorrect.correct(msgid, msgstr) 
11          print msgid 
12          print msgstr 
13          print corrected 
14          assert corrected == expected 
 15   
17          """test that we convert single ... to three dots""" 
18          self.correct("String...", "String…", "String...") 
 19   
21          """test that we can correct leading and trailing space errors""" 
22          self.correct("Simple string", "Dimpled ring  ", "Dimpled ring") 
23          self.correct("Simple string", "  Dimpled ring", "Dimpled ring") 
24          self.correct("  Simple string", "Dimpled ring", "  Dimpled ring") 
25          self.correct("Simple string  ", "Dimpled ring", "Dimpled ring  ") 
 26   
28          """test that we can correct the starting capital""" 
29          self.correct("Simple string", "dimpled ring", "Dimpled ring") 
30          self.correct("simple string", "Dimpled ring", "dimpled ring") 
 31   
33          """test that we can correct end punctuation""" 
34          self.correct("Simple string:", "Dimpled ring", "Dimpled ring:") 
35           
36          self.correct("Simple string.", "Dimpled ring", "Dimpled ring.") 
37           
38          self.correct("Simple string?", "Dimpled ring", "Dimpled ring?") 
  39