-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…6315) * Refactored get_email_address_list to have a better separation between string handling and other iterables. * Explicitely casting get_email_address_list argument to a list in case the argument was an iterable. This enables direct support for tuples, sets or the like. * Fixed type annotation of email parameter of BaseOperator to show that iterables are directly supported. * Added docstring entries for email, email_on_retry, email_on_failure and queue in BaseOperator. (cherry picked from commit 9ec562f)
- Loading branch information
1 parent
e93bd30
commit 12603b2
Showing
3 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,12 @@ | |
|
||
class EmailTest(unittest.TestCase): | ||
|
||
def test_get_email_address_single_email(self): | ||
emails_string = '[email protected]' | ||
|
||
self.assertEqual( | ||
get_email_address_list(emails_string), [emails_string]) | ||
|
||
def test_get_email_address_comma_sep_string(self): | ||
emails_string = '[email protected], [email protected]' | ||
|
||
|
@@ -42,3 +48,21 @@ def test_get_email_address_list(self): | |
|
||
self.assertEqual( | ||
get_email_address_list(emails_list), EMAILS) | ||
|
||
def test_get_email_address_tuple(self): | ||
emails_tuple = ('[email protected]', '[email protected]') | ||
|
||
self.assertEqual( | ||
get_email_address_list(emails_tuple), EMAILS) | ||
|
||
def test_get_email_address_invalid_type(self): | ||
emails_string = 1 | ||
|
||
self.assertRaises( | ||
TypeError, get_email_address_list, emails_string) | ||
|
||
def test_get_email_address_invalid_type_in_iterable(self): | ||
emails_list = ['[email protected]', 2] | ||
|
||
self.assertRaises( | ||
TypeError, get_email_address_list, emails_list) |