本文整理汇总了Python中abl.vpath.base.URI.info方法的典型用法代码示例。如果您正苦于以下问题:Python URI.info方法的具体用法?Python URI.info怎么用?Python URI.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类abl.vpath.base.URI
的用法示例。
在下文中一共展示了URI.info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_info_mtime
# 需要导入模块: from abl.vpath.base import URI [as 别名]
# 或者: from abl.vpath.base.URI import info [as 别名]
def test_info_mtime(self):
p = URI("test.txt")
now = datetime.datetime.now()
size = p.info().size
with p.open('a') as fs:
fs.write(' again')
self.assertTrue(p.info().mtime >= p.info().ctime)
self.assertTrue( p.info().size > size)
# due to now's millisecond resolution, we must ignore milliseconds
self.assertTrue(p.info().mtime.timetuple()[:6] >= now.timetuple()[:6])
示例2: test_setting_mode
# 需要导入模块: from abl.vpath.base import URI [as 别名]
# 或者: from abl.vpath.base.URI import info [as 别名]
def test_setting_mode(self):
# setting the permission flags are not supported on windows
if sys.platform != "win32":
p = URI("test.txt")
mode = p.info().mode
new_mode = mode | stat.S_IXUSR
p.info(dict(mode=new_mode))
self.assertEqual(
p.info().mode,
new_mode,
)
示例3: test_info_on_symlinks
# 需要导入模块: from abl.vpath.base import URI [as 别名]
# 或者: from abl.vpath.base.URI import info [as 别名]
def test_info_on_symlinks(self):
a_file = URI("test.txt")
a_link = URI("test_link")
with a_file.open('w') as f:
f.write("a" * 800)
if not a_file.connection.supports_symlinks():
return
self.assertEqual(a_file.info().size, 800)
self.assertEqual(a_link.info().size, 800)
self.assertNotEqual(a_link.info(followlinks=False).size, 800)
示例4: test_set_info_on_symlinks
# 需要导入模块: from abl.vpath.base import URI [as 别名]
# 或者: from abl.vpath.base.URI import info [as 别名]
def test_set_info_on_symlinks(self):
# lchmod is not supported on Linux, only on OSX
a_file = URI("test.txt")
a_link = URI("test_link")
with a_file.open('w') as f:
f.write("a" * 800)
if not a_file.connection.supports_symlinks():
return
self.assertEqual(a_file.info().size, 800)
self.assertEqual(a_link.info().size, 800)
self.assertNotEqual(a_link.info(followlinks=False).size, 800)
orig_info = a_file.info()
a_link.info({'mode': 0o120700}, followlinks=False)
self.assertEqual(a_file.info().mode, orig_info.mode)
self.assertEqual(a_link.info().mode, orig_info.mode)
self.assertEqual(a_link.info(followlinks=False).mode, 0o120700)
示例5: test_info_ctime
# 需要导入模块: from abl.vpath.base import URI [as 别名]
# 或者: from abl.vpath.base.URI import info [as 别名]
def test_info_ctime(self):
p = URI("test.txt")
self.assertTrue(p.info().ctime <= datetime.datetime.now())
self.assertEqual(p.info().ctime, p.info().mtime)