Skip to content

Commit f8bfdab

Browse files
committed
Code formatting
1 parent 15f9bc1 commit f8bfdab

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

checkdmarc/spf.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,15 @@ def parse_spf_record(
616616
seen.append(value.lower())
617617

618618
if "%{" in value:
619-
include = OrderedDict([
620-
("action", action),
621-
("mechanism", mechanism),
622-
("value", value),
623-
("dns_lookups", mechanism_dns_lookups),
624-
("void_dns_lookups", mechanism_void_dns_lookups),
625-
])
619+
include = OrderedDict(
620+
[
621+
("action", action),
622+
("mechanism", mechanism),
623+
("value", value),
624+
("dns_lookups", mechanism_dns_lookups),
625+
("void_dns_lookups", mechanism_void_dns_lookups),
626+
]
627+
)
626628
parsed["mechanisms"].append(include)
627629
continue
628630
try:

tests.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@ def testSPFMXMechanism(self):
307307
results = checkdmarc.spf.parse_spf_record(spf_record, domain)
308308
for mechanism in results["parsed"]["mechanisms"]:
309309
if mechanism["mechanism"] == "mx":
310-
self.assertTrue(len(mechanism["hosts"] ) > 0 )
310+
self.assertTrue(len(mechanism["hosts"]) > 0)
311311
for host in mechanism["hosts"]:
312312
self.assertTrue(len(host) > 0)
313-
313+
314314
def testSPFMacrosExists(self):
315315
"""SPF macros can be used with the exists mechanism"""
316-
record ="v=spf1 exists:exists:%{i}.spf.hc0000-xx.iphmx.com ~all"
316+
record = "v=spf1 exists:exists:%{i}.spf.hc0000-xx.iphmx.com ~all"
317317
domain = "example.com"
318318
results = checkdmarc.spf.parse_spf_record(record, domain)
319319
self.assertTrue(len(results["parsed"]["mechanisms"]) > 0)
@@ -325,15 +325,14 @@ def testSPFMacrosInclude(self):
325325
results = checkdmarc.spf.parse_spf_record(record, domain)
326326
self.assertTrue(len(results["parsed"]["mechanisms"]) > 0)
327327

328-
329328
def testSPFAMechanism(self):
330329
"""Addresses are included in the output for SPF records with an a lookup"""
331330
spf_record = "v=spf1 a ~all"
332331
domain = "example.com"
333332
results = checkdmarc.spf.parse_spf_record(spf_record, domain)
334333
for mechanism in results["parsed"]["mechanisms"]:
335334
if mechanism["mechanism"] == "a":
336-
self.assertTrue(len(mechanism["addresses"] ) > 0 )
335+
self.assertTrue(len(mechanism["addresses"]) > 0)
337336

338337
@unittest.skipUnless(os.path.exists("/etc/resolv.conf"), "no network")
339338
def testDMARCPctLessThan100Warning(self):

0 commit comments

Comments
 (0)