This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Oleg.Plakhotnyuk, ezio.melotti, giampaolo.rodola, ncoghlan, python-dev, r.david.murray, rhettinger, vstinner
Date 2012-05-30.08:21:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338366067.85.0.267077086965.issue14796@psf.upfronthosting.co.za>
In-reply-to
Content
> New changeset 98bc9e357f74 by R David Murray in branch 'default':
> #14796: improve calendar test coverage.
> http://hg.python.org/cpython/rev/98bc9e357f74

The following added test fails on Windows:

...
+    def test_yeardatescalendar(self):
+        def shrink(cal):
+            return [[[' '.join((d.strftime('%D')
+                    for d in z)) for z in y] for y in x] for x in cal]
         self.assertEqual(
-            cal.formatyearpage(2004, encoding=encoding).strip(b' \t\n'),
-            result_2004_html.strip(' \t\n').encode(encoding)
+            shrink(calendar.Calendar().yeardatescalendar(2004)),
+            result_2004_dates
+        )
...

The "%D" format is not supported by strftime(). Extract of timemodule.c:

#if defined(MS_WINDOWS) && !defined(HAVE_WCSFTIME)
    /* check that the format string contains only valid directives */
    for(outbuf = strchr(fmt, '%');
        outbuf != NULL;
        outbuf = strchr(outbuf+2, '%'))
    {
        if (outbuf[1]=='#')
            ++outbuf; /* not documented by python, */
        if (outbuf[1]=='\0' ||
            !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
        {
            PyErr_SetString(PyExc_ValueError, "Invalid format string");
            Py_DECREF(format);
            return NULL;
        }
    }
#endif
History
Date User Action Args
2012-05-30 08:21:07vstinnersetrecipients: + vstinner, rhettinger, ncoghlan, giampaolo.rodola, ezio.melotti, r.david.murray, python-dev, Oleg.Plakhotnyuk
2012-05-30 08:21:07vstinnersetmessageid: <1338366067.85.0.267077086965.issue14796@psf.upfronthosting.co.za>
2012-05-30 08:21:07vstinnerlinkissue14796 messages
2012-05-30 08:21:06vstinnercreate