當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。