本文整理汇总了Python中elodie.filesystem.FileSystem.set_utime方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.set_utime方法的具体用法?Python FileSystem.set_utime怎么用?Python FileSystem.set_utime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elodie.filesystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.set_utime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_utime_without_exif_date
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import set_utime [as 别名]
def test_set_utime_without_exif_date():
filesystem = FileSystem()
temporary_folder, folder = helper.create_working_folder()
origin = os.path.join(folder,'photo.jpg')
shutil.copyfile(helper.get_file('no-exif.jpg'), origin)
media_initial = Photo(origin)
metadata_initial = media_initial.get_metadata()
initial_stat = os.stat(origin)
initial_time = int(min(initial_stat.st_mtime, initial_stat.st_ctime))
initial_checksum = helper.checksum(origin)
assert initial_time == time.mktime(metadata_initial['date_taken'])
filesystem.set_utime(media_initial)
final_stat = os.stat(origin)
final_checksum = helper.checksum(origin)
media_final = Photo(origin)
metadata_final = media_final.get_metadata()
shutil.rmtree(folder)
assert initial_time == final_stat.st_mtime
assert final_stat.st_mtime == time.mktime(metadata_final['date_taken']), (final_stat.st_mtime, time.mktime(metadata_final['date_taken']))
assert initial_checksum == final_checksum