def test_time_tag_future(self): date = datetime.datetime(2000, 1, 2, 3, 4, 5) output = time_tag(date, future=True) expected = '<time datetime="{}" class="in">{}</time>'.format( date.isoformat(), date.strftime("%a, %b %d, %Y at %H:%M %Z")) assert output == expected
def test_time_tag_future(self): date = datetime.datetime(2000, 1, 2, 3, 4, 5) output = time_tag(date, future=True) eq_( output, '<time datetime="{}" class="in">{}</time>'.format( date.isoformat(), date.strftime('%a, %b %d %H:%M %Z')))
def test_time_tag_with_date(self): date = datetime.date(2000, 1, 2) output = time_tag(date) expected = '<time datetime="{}" class="ago">{}</time>'.format( date.isoformat(), date.strftime("%a, %b %d, %Y at %H:%M %Z")) assert output == expected
def test_time_tag_with_date(self): date = datetime.date(2000, 1, 2) output = time_tag(date) eq_( output, '<time datetime="{}" class="ago">{}</time>'.format( date.isoformat(), date.strftime('%a, %b %d %H:%M %Z')))
def test_parse_with_unicode_with_timezone(self): # See https://bugzilla.mozilla.org/show_bug.cgi?id=1300921 date = "2016-09-07T00:38:42.630775+00:00" output = time_tag(date) expected = '<time datetime="{}" class="ago">{}</time>'.format( "2016-09-07T00:38:42.630775+00:00", "Wed, Sep 07 00:38 +00:00") assert output == expected
def test_time_tag_future(self): date = datetime.datetime(2000, 1, 2, 3, 4, 5) output = time_tag(date, future=True) eq_(output, '<time datetime="{}" class="in">{}</time>'.format( date.isoformat(), date.strftime('%a, %b %d %H:%M %Z') ))
def test_time_tag_with_date(self): date = datetime.date(2000, 1, 2) output = time_tag(date) eq_(output, '<time datetime="{}" class="ago">{}</time>'.format( date.isoformat(), date.strftime('%a, %b %d %H:%M %Z') ))
def test_parse_with_unicode_with_timezone(self): # See https://bugzilla.mozilla.org/show_bug.cgi?id=1300921 date = u'2016-09-07T00:38:42.630775+00:00' output = time_tag(date) eq_( output, '<time datetime="{}" class="ago">{}</time>'.format( '2016-09-07T00:38:42.630775+00:00', 'Wed, Sep 07 00:38 +00:00'))
def test_parse_with_unicode_with_timezone(self): # See https://bugzilla.mozilla.org/show_bug.cgi?id=1300921 date = u'2016-09-07T00:38:42.630775+00:00' output = time_tag(date) eq_(output, '<time datetime="{}" class="ago">{}</time>'.format( '2016-09-07T00:38:42.630775+00:00', 'Wed, Sep 07 00:38 +00:00' ))
def test_time_tag_with_datetime(self): date = datetime.datetime(2000, 1, 2, 3, 4, 5) output = time_tag(date) expected = '<time datetime="{}" class="ago">{}</time>'.format( date.isoformat(), date.strftime('%a, %b %d %H:%M %Z') ) assert output == expected
def test_time_tag_invalid_date(self): output = time_tag("junk") assert output == "junk"
def test_time_tag_invalid_date(self): output = time_tag('junk') assert output == 'junk'
def test_time_tag_invalid_date(self): output = time_tag('junk') eq_(output, 'junk')