def format_date(self, date, format='%x', **kwargs): if kwargs: conv = self.localeconv().copy() conv.update(kwargs) else: conv = self.localeconv() result = locfmt.format_date(date, format, conv) return result
def test_basic(self): for object,fmt,result in self.data: if isinstance(object, datetime.date): assert format.format_date(object, fmt, self.langinfo) == result elif isinstance(object, datetime.time): assert format.format_time(object, fmt, self.langinfo) == result elif isinstance(object, datetime.datetime): assert format.format_datetime(object, fmt, self.langinfo) == result