Beispiel #1
0
 def decode_row(self, row):
     if ':' in row:
         language, word = (item.strip() for item in row.split(':', 1))
         if len(language) != 2:
             raise forms.ValidationError(
                 _('Invalid language code on line: %s' % str_repr(row)))
     else:
         language = None
         word = row
     normalized_spelling = lower_without_diacritics(word)
     if not normalized_spelling:
         raise forms.ValidationError(
             _('No word found on line %s' % str_repr(row)))
     return language, normalized_spelling
 def test_06_normalize(self):
     self.assertEqual(lower_without_diacritics(u'Saint-Saëns Martinů'),
                      u'saint-saens martinu')