From f3452eb821b3dfb72341c3dc5a45cb889b7d55ee Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Mon, 1 Jun 2026 20:10:21 +0000 Subject: [PATCH 1/3] Update formatter to handle Google email addresses with + signs --- google/ads/datamanager_util/format.py | 3 +++ tests/formatter_test.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/google/ads/datamanager_util/format.py b/google/ads/datamanager_util/format.py index 197f2ca..865f2bb 100644 --- a/google/ads/datamanager_util/format.py +++ b/google/ads/datamanager_util/format.py @@ -90,6 +90,9 @@ def format_email_address(self, email: str) -> str: # "Create variations of your email address" at: # https://support.google.com/a/users/answer/9282734 + # Removes plus sign (+) and all characters that follow it. + user = user.split("+")[0] + # Removes all periods (.). user = re.sub("\\.", "", user) if len(user) == 0: diff --git a/tests/formatter_test.py b/tests/formatter_test.py index cbb48c9..8beb616 100644 --- a/tests/formatter_test.py +++ b/tests/formatter_test.py @@ -49,6 +49,24 @@ def test_format_email_address_valid_inputs(self): "Periods should be stripped from googlemail.com address", ) + self.assertEqual( + "janedoe@googlemail.com", + self.formatter.format_email_address("Jane.Doe+shopping@googlemail.com"), + "Plus sign and everything after should be stripped from googlemail.com address", + ) + + self.assertEqual( + "janedoe@gmail.com", + self.formatter.format_email_address("Jane.Doe+shopping@gmail.com"), + "Plus sign and everything after should be stripped from gmail.com address", + ) + + self.assertEqual( + "user.name+nyc@example.com", + self.formatter.format_email_address("user.name+NYC@Example.com"), + "Plus sign and everything after should not be stripped from non google emails", + ) + def test_format_email_address_invalid_inputs(self): with self.assertRaises(ValueError): self.formatter.format_email_address(None) From d52d4d669df33a49e5117647fc6c3d35abf6c976 Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Mon, 1 Jun 2026 21:42:00 +0000 Subject: [PATCH 2/3] Update example email addresses --- tests/formatter_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/formatter_test.py b/tests/formatter_test.py index 8beb616..afd3119 100644 --- a/tests/formatter_test.py +++ b/tests/formatter_test.py @@ -50,14 +50,14 @@ def test_format_email_address_valid_inputs(self): ) self.assertEqual( - "janedoe@googlemail.com", - self.formatter.format_email_address("Jane.Doe+shopping@googlemail.com"), + "cloudysanfrancisco@googlemail.com", + self.formatter.format_email_address("Cloudy.SanFrancisco+shopping@googlemail.com"), "Plus sign and everything after should be stripped from googlemail.com address", ) self.assertEqual( - "janedoe@gmail.com", - self.formatter.format_email_address("Jane.Doe+shopping@gmail.com"), + "cloudysanfrancisco@gmail.com", + self.formatter.format_email_address("Cloudy.SanFrancisco+shopping@gmail.com"), "Plus sign and everything after should be stripped from gmail.com address", ) From 16df0e383532335c658e37a5d45eafb5923c8dcd Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Tue, 2 Jun 2026 13:53:13 +0000 Subject: [PATCH 3/3] Update version of utility --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3d2ac39..eaf9e3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta" [project] name = "google-ads-datamanager-util" -version = "0.2.0" +version = "0.3.0" description = "Utilities for the Data Manager API" readme = "./README.rst" requires-python = ">=3.9, <3.14"