当前位置: 首页>>代码示例>>Python>>正文


Python URI.info方法代码示例

本文整理汇总了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])
开发者ID:AbletonAG,项目名称:abl.vpath,代码行数:12,代码来源:test_localfs.py

示例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,
             )
开发者ID:AbletonAG,项目名称:abl.vpath,代码行数:13,代码来源:test_localfs.py

示例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)
开发者ID:AbletonAG,项目名称:abl.vpath,代码行数:14,代码来源:test_localfs.py

示例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)
开发者ID:AbletonAG,项目名称:abl.vpath,代码行数:22,代码来源:test_localfs.py

示例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)
开发者ID:AbletonAG,项目名称:abl.vpath,代码行数:6,代码来源:test_localfs.py


注:本文中的abl.vpath.base.URI.info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。