From 36b6371e647263888c1dfc53ec2b1ef218871127 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 7 Oct 2023 15:06:24 +0000 Subject: [PATCH] Validate date fields in front matter --- scripts/tools/test_feps.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/tools/test_feps.py b/scripts/tools/test_feps.py index 8edafd7..128520e 100644 --- a/scripts/tools/test_feps.py +++ b/scripts/tools/test_feps.py @@ -1,3 +1,4 @@ +import datetime import pytest import hashlib @@ -21,6 +22,13 @@ def test_fep(fep): if parsed_frontmatter["status"] == "WITHDRAWN": assert "dateWithdrawn" in parsed_frontmatter + for field_name in ["dateReceived", "dateFinalized", "dateWithdrawn"]: + if field_name in parsed_frontmatter: + datetime.datetime.strptime( + parsed_frontmatter[field_name], + "%Y-%m-%d" + ) + assert "## Summary" in content assert "## Copyright" in content