if num <= 2:
return ('%%0%dd' % num) % self.value.month
width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[num]
- context = {3: 'format', 4: 'format', 5: 'stand-alone'}[num]
+ context = {'M': 'format', 'L': 'stand-alone'}[char]
return get_month_names(width, context, self.locale)[self.value.month]
def format_week(self, char, num):
class DateTimeFormatTestCase(unittest.TestCase):
+ def test_month_context(self):
+ d = date(2006, 1, 8)
+ fmt = dates.DateTimeFormat(d, locale='cs_CZ')
+ self.assertEqual('1', fmt['MMM'])
+ fmt = dates.DateTimeFormat(d, locale='cs_CZ')
+ self.assertEqual('1.', fmt['LLL'])
+
def test_week_of_year_first(self):
d = date(2006, 1, 8)
fmt = dates.DateTimeFormat(d, locale='de_DE')