Skip to content

Commit

Permalink
Merge branch 'main' into mod-action
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunagm authored Oct 10, 2024
2 parents b31c482 + 22c3175 commit 19ddcc1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test_gmail/test_gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import email
import json
import os
import requests_mock
import shutil
import unittest

Expand Down Expand Up @@ -517,6 +518,25 @@ def test_validate_email_string_valid(self):
"<[email protected]>",
]

# The behavior of email.parseaddr depends on the python patch version
# See https://github.com/python/cpython/issues/102988
# or associated changelogs, e.g.
# https://docs.python.org/3.8/whatsnew/changelog.html#python-3-8-20-final
if getattr(email.utils, "supports_strict_parsing", False):
emails.extend(
[
{"email": "Sender <sender@email,com>", "expected": False},
{"email": "Sender <sender+alias@email,com>", "expected": False},
]
)
else:
emails.extend(
[
{"email": "Sender <sender@email,com>", "expected": True},
{"email": "Sender <sender+alias@email,com>", "expected": True},
]
)

for e in emails:
self.assertTrue(self.gmail._validate_email_string(e))

Expand Down

0 comments on commit 19ddcc1

Please sign in to comment.