Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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')))
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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')))
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    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')
        ))
Exemplo n.º 7
0
    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')
        ))
Exemplo n.º 8
0
    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'))
Exemplo n.º 9
0
    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'
        ))
Exemplo n.º 10
0
    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
Exemplo n.º 11
0
 def test_time_tag_invalid_date(self):
     output = time_tag("junk")
     assert output == "junk"
Exemplo n.º 12
0
 def test_time_tag_invalid_date(self):
     output = time_tag('junk')
     assert output == 'junk'
Exemplo n.º 13
0
 def test_time_tag_invalid_date(self):
     output = time_tag('junk')
     eq_(output, 'junk')
Exemplo n.º 14
0
 def test_time_tag_invalid_date(self):
     output = time_tag('junk')
     eq_(output, 'junk')
Exemplo n.º 15
0
 def test_time_tag_invalid_date(self):
     output = time_tag('junk')
     assert output == 'junk'