From e3ef622031c65c694592ce039ee308b8351a89d7 Mon Sep 17 00:00:00 2001 From: Alex Riina Date: Sun, 8 Mar 2015 00:33:03 -0500 Subject: [PATCH] remove unused regex --- talon/signature/learning/helpers.py | 8 -------- tests/signature/learning/helpers_test.py | 23 ----------------------- 2 files changed, 31 deletions(-) diff --git a/talon/signature/learning/helpers.py b/talon/signature/learning/helpers.py index 70a4820..38259c3 100644 --- a/talon/signature/learning/helpers.py +++ b/talon/signature/learning/helpers.py @@ -40,14 +40,6 @@ RE_SIGNATURE_WORDS = rc(('(T|t)hank.*,|(B|b)est|(R|r)egards|' # Line contains a pattern like Vitor R. Carvalho or William W. Cohen. RE_NAME = rc('[A-Z][a-z]+\s\s?[A-Z][\.]?\s\s?[A-Z][a-z]+') -# Pattern to match if e.g. 'Sender:' header field has sender names. -SENDER_WITH_NAME_PATTERN = '([\s]*[\S]+,?)+[\s]*<.*>.*' -RE_SENDER_WITH_NAME = rc(SENDER_WITH_NAME_PATTERN) - -# Reply line clue line endings, as in regular expression: -# " wrote:$" or " writes:$" -RE_CLUE_LINE_END = rc('.*(W|w)rotes?:$') - INVALID_WORD_START = rc('\(|\+|[\d]') BAD_SENDER_NAMES = [ diff --git a/tests/signature/learning/helpers_test.py b/tests/signature/learning/helpers_test.py index 29b6fca..7a57f6c 100644 --- a/tests/signature/learning/helpers_test.py +++ b/tests/signature/learning/helpers_test.py @@ -52,29 +52,6 @@ def test_match_names(): ok_(RE_NAME.match(name), "{} should be matched".format(name)) -def test_sender_with_name(): - ok_lines = ['Sergey Obukhov ', - '\tSergey ', - ('"Doe, John (TX)"' - '@EXAMPLE' - ''), - ('Company Sleuth ' - '@EXAMPLE '), - ('Doe III, John ' - '')] - for line in ok_lines: - ok_(RE_SENDER_WITH_NAME.match(line), - '{} should be matched'.format(line)) - - nok_lines = ['', '', 'Sergey serobnic@xxx.ru'] - for line in nok_lines: - assert_false(RE_SENDER_WITH_NAME.match(line), - '{} should not be matched'.format(line)) - - # Now test helpers functions def test_binary_regex_search(): eq_(1, h.binary_regex_search(re.compile("12"))("12"))