Skip to content

Commit

Permalink
Merge pull request #1095 from paul23-git/make_recipient_repr_match_imap
Browse files Browse the repository at this point in the history
Added angled brackets instead of braces to repr of recipient
  • Loading branch information
alejcas authored Jul 16, 2024
2 parents f1381ad + d1f13f2 commit 0e40e98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion O365/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __str__(self):

def __repr__(self):
if self.name:
return '{} ({})'.format(self.name, self.address)
return '{} <{}>'.format(self.name, self.address)
else:
return self.address

Expand Down
21 changes: 21 additions & 0 deletions tests/test_recipient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

from O365.utils import Recipient


class TestRecipient:
def setup_class(self):
pass

def teardown_class(self):
pass

def test_recipient_str(self):
recipient = Recipient()
assert str(recipient) == ""

recipient = Recipient(address="john@example.com")
assert str(recipient) == "john@example.com"

recipient = Recipient(address="john@example.com", name="John Doe")
assert str(recipient) == "John Doe <john@example.com>"

0 comments on commit 0e40e98

Please sign in to comment.