diff test/test_templating.py @ 8570:16e8bacb8f90

test: strftime formats; Runtime v Parsing error config.ini windows python strftime formats like "%2d" are not supported by windows python. So limit testing to non-win32 platform. In tests RuntimeError (not ParsingError) was returned for an invalid config.ini parse error with 3.12 and newer. Windows Python 3.11.4 returns RuntimeError as well. Changed guard that chooses RuntimeError to 3.11.4 or newer.
author John Rouillard <rouilj@ieee.org>
date Mon, 13 Apr 2026 13:28:58 -0400
parents 9c3ec0a5c7fc
children 670c0ed0becd
line wrap: on
line diff
--- a/test/test_templating.py	Mon Apr 13 12:55:03 2026 -0400
+++ b/test/test_templating.py	Mon Apr 13 13:28:58 2026 -0400
@@ -890,6 +890,8 @@
     def test_DateHTMLWithDate(self):
         """Test methods when DateHTMLProperty._value is a hyperdb.Date()
         """
+        import sys
+        
         self.client.db.config['WEB_USE_BROWSER_DATE_INPUT'] = True
         test_datestring = self.test_datestring
         test_Date = self.client.db.issue.get("1", 'deadline')
@@ -904,7 +906,9 @@
                              'deadline', test_Date)
         self.assertIsInstance(d._value, date.Date)
         self.assertEqual(d.pretty(), " 1 January 2021")
-        self.assertEqual(d.pretty("%2d %B %Y"), "01 January 2021")
+        if sys.platform != "win32":  # %2d not supported on windows
+            self.assertEqual(d.pretty("%2d %B %Y"), "01 January 2021")
+        self.assertEqual(d.pretty("%d %B %Y"), " 1 January 2021")            
         self.assertEqual(d.pretty(format="%Y-%m"), "2021-01")
         self.assertEqual(d.plain(), "2021-01-01.13:22:10")
         self.assertEqual(d.local("-4").plain(), "2021-01-01.07:22:10")

Roundup Issue Tracker: http://roundup-tracker.org/