本文整理匯總了Python中repo.Repo.load_from_disk方法的典型用法代碼示例。如果您正苦於以下問題:Python Repo.load_from_disk方法的具體用法?Python Repo.load_from_disk怎麽用?Python Repo.load_from_disk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類repo.Repo
的用法示例。
在下文中一共展示了Repo.load_from_disk方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_load_version_mismatch_error
# 需要導入模塊: from repo import Repo [as 別名]
# 或者: from repo.Repo import load_from_disk [as 別名]
def test_load_version_mismatch_error(self):
self.conf['index.format_version'] = 99
Repo.create_on_disk(self.connector, self.conf, self.pi)
with self.assertRaises(VersionMismatchError) as cm:
Repo.load_from_disk(self.connector)
self.assertEqual(cm.exception.actual, 99)
self.assertEqual(cm.exception.expected, repo.INDEX_FORMAT_VERSION)
示例2: test_load_from_disk
# 需要導入模塊: from repo import Repo [as 別名]
# 或者: from repo.Repo import load_from_disk [as 別名]
def test_load_from_disk(self):
repo_created = Repo.create_on_disk(self.connector, self.conf, self.pi)
repo_loaded = Repo.load_from_disk(self.connector)
self.assertIsInstance(repo_loaded, Repo)
self.assertEqual(repo_loaded.config, repo_created.config)
self.assertIsNot(repo_loaded.config, repo_created.config)
self.assertEqual(repo_loaded.index, repo_created.index)
self.assertIsNot(repo_loaded.index, repo_created.index)
self.assertIsNot(repo_loaded, repo_created)
self.assertIs(repo_loaded.connector, self.connector)
示例3: test_load_notfound_error
# 需要導入模塊: from repo import Repo [as 別名]
# 或者: from repo.Repo import load_from_disk [as 別名]
def test_load_notfound_error(self):
self.connector.exists = mock.Mock(return_value=False)
with self.assertRaises(NotFoundError) as cm:
Repo.load_from_disk(self.connector)
self.assertEqual(cm.exception.url, self.connector.url)