From c22802fc6a7cdd5643d55a89f38b95d149fd2650 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 8 Jun 2017 16:09:24 +0200 Subject: Correct membership test --- alot/addressbook/external.py | 2 +- tests/addressbook/external_test.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/alot/addressbook/external.py b/alot/addressbook/external.py index 6a89dd15..9de86f36 100644 --- a/alot/addressbook/external.py +++ b/alot/addressbook/external.py @@ -68,7 +68,7 @@ class ExternalAddressbook(AddressBook): m = re.match(self.regex, l, self.reflags) if m: info = m.groupdict() - if 'email' and 'name' in info: + if 'email' in info and 'name' in info: email = info['email'].strip() name = info['name'] res.append((name, email)) diff --git a/tests/addressbook/external_test.py b/tests/addressbook/external_test.py index 059140a6..2211769e 100644 --- a/tests/addressbook/external_test.py +++ b/tests/addressbook/external_test.py @@ -53,7 +53,6 @@ class TestExternalAddressbookGetContacts(unittest.TestCase): actual = abook.get_contacts() self.assertListEqual(actual, []) - @unittest.expectedFailure def test_returns_empty_list_if_regex_has_no_email_submatches(self): abook = external.ExternalAddressbook( 'foobar', self.regex.replace('email', 'xemail')) -- cgit v1.2.3