From 0403ce96e2a6c44c3cab43c584826801f40f77e9 Mon Sep 17 00:00:00 2001
From: Karl-Hermann Wieners <karl-hermann.wieners@mpimet.mpg.de>
Date: Fri, 10 Jan 2025 19:19:37 +0100
Subject: [PATCH] Config: add more patterns to period2sec test

---
 test.py | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/test.py b/test.py
index c5d89ba..31cff5e 100644
--- a/test.py
+++ b/test.py
@@ -459,13 +459,28 @@ class ContentTestCase(MkexpSimpleTestCase):
         """)
 
     def test_period2sec(self):
-        self.run_test(u"""
-            %{VALUE}
-        """, u"""
-            93784
-        """, u"""
-            VALUE = period2sec(P1DT2H3M4S)
-        """)
+        template = ""
+        expected = ""
+        additional = ""
+        for i in range(1, 16):
+            period = (
+                "P" +
+                ("1D" if i&8 else "") +
+                ("T" if i&7 else "") +
+                ("2H" if i&4 else "") +
+                ("3M" if i&2 else "") +
+                ("4S" if i&1 else "")
+            )
+            seconds = (
+                (86400 if i&8 else 0) +
+                (7200 if i&4 else 0) +
+                (180 if i&2 else 0) +
+                (4 if i&1 else 0)
+            )
+            template += f"%{{VALUE{i}}}\n"
+            expected += f"{seconds}\n"
+            additional += f"VALUE{i} = period2sec({period})\n"
+        self.run_test(template, expected, additional)
 
     def test_initial_comment_boilerplate(self):
         writeconfig(self.exp_id, u"""
-- 
GitLab