Skip to content

Commit

Permalink
fix: revert "feat: Add equality to Email" (#904)
Browse files Browse the repository at this point in the history
This reverts commit b2ca1f4.
  • Loading branch information
childish-sambino authored Jun 12, 2020
1 parent 6fe3d3c commit 75cc2d1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
21 changes: 0 additions & 21 deletions sendgrid/helpers/mail/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,6 @@ def __init__(self,
if p is not None:
self.personalization = p

def __eq__(self, other):
"""Email objects are equal if they have the same email and the same name
:param other: object to compare with
:type other: any
"""
if isinstance(other, Email):
return self.email == other.email and self.name == other.name
return NotImplemented

def __ne__(self, other):
"""Inverse of __eq__ (required for Python 2)
:param other: object to compare with
:type other: any
"""
x = self.__eq__(other)
if x is not NotImplemented:
return not x
return NotImplemented

@property
def name(self):
"""Name associated with this email.
Expand Down
48 changes: 0 additions & 48 deletions test/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,51 +80,3 @@ 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)

0 comments on commit 75cc2d1

Please sign in to comment.