Example #1
0
 def test_clean_subject(self):
     self.assertEqual(clean_subject('meep'), ('meep', []))
     self.assertEqual(clean_subject('Re: meep'), ('meep', []))
     self.assertEqual(clean_subject('[PATCH] meep'), ('meep', []))
     self.assertEqual(clean_subject("[PATCH] meep \n meep"),
                      ('meep meep', []))
     self.assertEqual(clean_subject('[PATCH RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH,RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH,1/2] meep'),
                      ('[1/2] meep', ['1/2']))
     self.assertEqual(clean_subject('[PATCH RFC 1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] [RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH] [RFC,1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] [RFC] [1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] rewrite [a-z] regexes'),
                      ('rewrite [a-z] regexes', []))
     self.assertEqual(clean_subject('[PATCH] [RFC] rewrite [a-z] regexes'),
                      ('[RFC] rewrite [a-z] regexes', ['RFC']))
     self.assertEqual(clean_subject('[foo] [bar] meep', ['foo']),
                      ('[bar] meep', ['bar']))
     self.assertEqual(clean_subject('[FOO] [bar] meep', ['foo']),
                      ('[bar] meep', ['bar']))
Example #2
0
 def _test_encoding(self, subject_header, parsed_subject):
     email = self._create_email(subject_header)
     name, _ = clean_subject(email.get('Subject'))
     self.assertEqual(name, parsed_subject)
Example #3
0
 def get_prefixes(self, instance):
     return clean_subject(instance.name)[1]
Example #4
0
 def test_clean_subject(self):
     self.assertEqual(clean_subject('meep'), ('meep', []))
     self.assertEqual(clean_subject('Re: meep'), ('meep', []))
     self.assertEqual(clean_subject('[PATCH] meep'), ('meep', []))
     self.assertEqual(clean_subject("[PATCH] meep \n meep"),
                      ('meep meep', []))
     self.assertEqual(clean_subject('[PATCH RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH,RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH,1/2] meep'),
                      ('[1/2] meep', ['1/2']))
     self.assertEqual(clean_subject('[PATCH RFC 1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] [RFC] meep'),
                      ('[RFC] meep', ['RFC']))
     self.assertEqual(clean_subject('[PATCH] [RFC,1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] [RFC] [1/2] meep'),
                      ('[RFC,1/2] meep', ['RFC', '1/2']))
     self.assertEqual(clean_subject('[PATCH] rewrite [a-z] regexes'),
                      ('rewrite [a-z] regexes', []))
     self.assertEqual(clean_subject('[PATCH] [RFC] rewrite [a-z] regexes'),
                      ('[RFC] rewrite [a-z] regexes', ['RFC']))
     self.assertEqual(clean_subject('[foo] [bar] meep', ['foo']),
                      ('[bar] meep', ['bar']))
     self.assertEqual(clean_subject('[FOO] [bar] meep', ['foo']),
                      ('[bar] meep', ['bar']))
Example #5
0
 def _test_encoding(self, subject_header, parsed_subject):
     email = self._create_email(subject_header)
     name, _ = clean_subject(email.get('Subject'))
     self.assertEqual(name, parsed_subject)
Example #6
0
 def get_prefixes(self, instance):
     return clean_subject(instance.name)[1]