From cdb56904d3505cd33cb28498b09df3a8a2381d01 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Feb 2026 18:50:37 +0000 Subject: [PATCH] Make pct and fo default to None when not provided (DMARCbis reports) Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com> --- parsedmarc/__init__.py | 4 ++-- tests.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 9a32b28..b19cf91 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -810,12 +810,12 @@ def parse_aggregate_report_xml( if policy_published["sp"] is not None: sp = policy_published["sp"] new_policy_published["sp"] = sp - pct = "100" + pct = None if "pct" in policy_published: if policy_published["pct"] is not None: pct = policy_published["pct"] new_policy_published["pct"] = pct - fo = "0" + fo = None if "fo" in policy_published: if policy_published["fo"] is not None: fo = policy_published["fo"] diff --git a/tests.py b/tests.py index e2b78f0..18c402f 100755 --- a/tests.py +++ b/tests.py @@ -271,11 +271,12 @@ class Test(unittest.TestCase): self.assertEqual(pp["np"], "none") self.assertEqual(pp["testing"], "n") self.assertEqual(pp["discovery_method"], "treewalk") - # adkim/aspf/pct/fo default when not in XML + # adkim/aspf default when not in XML self.assertEqual(pp["adkim"], "r") self.assertEqual(pp["aspf"], "r") - self.assertEqual(pp["pct"], "100") - self.assertEqual(pp["fo"], "0") + # pct/fo are None on DMARCbis reports (not used) + self.assertIsNone(pp["pct"]) + self.assertIsNone(pp["fo"]) # Verify record self.assertEqual(len(report["records"]), 1)