-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Email objects are defined as equal iff they have the same email and the same name. This is useful for unit tests where we want to verify that the Email objects generated are as expected.
- Loading branch information
1 parent
ea90f7c
commit b2ca1f4
Showing
2 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,3 +80,51 @@ def test_add_unicode_name_with_comma(self): | |
email.name = name | ||
|
||
self.assertEqual(email.name, u'"' + name + u'"') | ||
|
||
def test_equality_email_name(self): | ||
address = "[email protected]" | ||
name = "SomeName" | ||
email1 = Email(address, name) | ||
email2 = Email(address, name) | ||
|
||
self.assertEqual(email1, email2) | ||
|
||
def test_equality_email(self): | ||
address = "[email protected]" | ||
email1 = Email(address) | ||
email2 = Email(address) | ||
|
||
self.assertEqual(email1, email2) | ||
|
||
def test_equality_name(self): | ||
name = "SomeName" | ||
email1 = Email() | ||
email1.name = name | ||
email2 = Email() | ||
email2.name = name | ||
|
||
self.assertEqual(email1, email2) | ||
|
||
def test_equality_different_emails(self): | ||
address1 = "[email protected]" | ||
email1 = Email(address1) | ||
address2 = "[email protected]" | ||
email2 = Email(address2) | ||
|
||
self.assertNotEqual(email1, email2) | ||
|
||
def test_equality_different_name(self): | ||
name1 = "SomeName1" | ||
email1 = Email() | ||
email1.name = name1 | ||
name2 = "SomeName2" | ||
email2 = Email() | ||
email2.name = name2 | ||
|
||
self.assertNotEqual(email1, email2) | ||
|
||
def test_equality_non_email(self): | ||
address = "[email protected]" | ||
email = Email(address) | ||
|
||
self.assertNotEqual(email, address) |