Skip to content

Commit ed9465d

Browse files
committed
Allow the __str__ method for the Mail object return an String instead of a NoneType
1 parent a5c1561 commit ed9465d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sendgrid/helpers/mail/mail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(
3333
self.add_content(content)
3434

3535
def __str__(self):
36-
self.get()
36+
return str(self.get())
3737

3838
def get(self):
3939
"""

test/test_mail.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def test_helloEmail(self):
6565
'"subject": "Hello World from the SendGrid Python Library"}'
6666
)
6767

68+
self.assertTrue(isinstance(str(mail), str))
69+
6870
def test_kitchenSink(self):
6971
self.maxDiff = None
7072

0 commit comments

Comments
 (0)