Пример #1
0
 def test_format_string(self):
     date = 'Tomorrow'
     with pytest.raises(AttributeError) as attr_err:
         format_date(date)
     assert attr_err.value.message == "'str' object has no attribute 'tm_wday'"
Пример #2
0
 def test_format_none(self):
     date = None
     formated = format_date(date)
     assert formated == format_date(gmtime())
Пример #3
0
 def test_format_int(self):
     date = 1482357361
     formated = format_date(date)
     assert formated == 'Wed, 21-Dec-2016 21:56:01 GMT'
Пример #4
0
 def test_format_datetime(self):
     date = datetime(2016, 12, 21, 21, 56, 01)
     formated = format_date(date)
     assert formated == 'Wed, 21-Dec-2016 21:56:01 GMT'
Пример #5
0
 def test_format_timestamp(self):
     date = datetime.fromtimestamp(1482357361)
     formated = format_date(date)
     assert formated == 'Wed, 21-Dec-2016 22:56:01 GMT'