本文整理汇总了Python中pyuploadcare.api_resources.File.datetime_uploaded方法的典型用法代码示例。如果您正苦于以下问题:Python File.datetime_uploaded方法的具体用法?Python File.datetime_uploaded怎么用?Python File.datetime_uploaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyuploadcare.api_resources.File
的用法示例。
在下文中一共展示了File.datetime_uploaded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FileDateMethodsTest
# 需要导入模块: from pyuploadcare.api_resources import File [as 别名]
# 或者: from pyuploadcare.api_resources.File import datetime_uploaded [as 别名]
class FileDateMethodsTest(unittest.TestCase):
def setUp(self):
self.file = File('a771f854-c2cb-408a-8c36-71af77811f3b')
def test_datetime_stored_is_none(self):
self.file._info_cache = {'datetime_stored': ''}
self.assertIsNone(self.file.datetime_stored())
def test_datetime_stored_is_utc(self):
self.file._info_cache = {'datetime_stored': '2013-02-05T12:56:12.006Z'}
expected_datetime = datetime.datetime(
year=2013, month=2, day=5, hour=12, minute=56, second=12,
microsecond=6000, tzinfo=tzutc())
self.assertEqual(self.file.datetime_stored(), expected_datetime)
def test_datetime_removed_is_none(self):
self.file._info_cache = {}
self.assertIsNone(self.file.datetime_removed())
def test_datetime_removed_is_utc(self):
self.file._info_cache = {'datetime_removed': '2013-02-05T12:56:12.006Z'}
expected_datetime = datetime.datetime(
year=2013, month=2, day=5, hour=12, minute=56, second=12,
microsecond=6000, tzinfo=tzutc())
self.assertEqual(self.file.datetime_removed(), expected_datetime)
def test_datetime_uploaded_is_none(self):
self.file._info_cache = {'datetime_uploaded': None}
self.assertIsNone(self.file.datetime_uploaded())
def test_datetime_uploaded_is_utc(self):
self.file._info_cache = {'datetime_uploaded': '2013-02-05T12:56:12.006Z'}
expected_datetime = datetime.datetime(
year=2013, month=2, day=5, hour=12, minute=56, second=12,
microsecond=6000, tzinfo=tzutc())
self.assertEqual(self.file.datetime_uploaded(), expected_datetime)