本文整理汇总了Python中enstaller.repository.Repository.find_sorted_packages方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.find_sorted_packages方法的具体用法?Python Repository.find_sorted_packages怎么用?Python Repository.find_sorted_packages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enstaller.repository.Repository
的用法示例。
在下文中一共展示了Repository.find_sorted_packages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_packages_sorting
# 需要导入模块: from enstaller.repository import Repository [as 别名]
# 或者: from enstaller.repository.Repository import find_sorted_packages [as 别名]
def test_find_packages_sorting(self):
# Given
entries = [
dummy_installed_package_factory("numpy", "1.6.1", 1),
dummy_installed_package_factory("numpy", "1.8.0", 2),
dummy_installed_package_factory("numpy", "1.7.1", 1),
]
repository = Repository()
for entry in entries:
repository.add_package(entry)
r_versions = [
EnpkgVersion.from_string(v)
for v in ("1.6.1-1", "1.7.1-1", "1.8.0-2")
]
# When
packages = repository.find_packages("numpy")
# Then
self.assertEqual(len(packages), 3)
self.assertEqual([p.version for p in packages], r_versions)
with self.assertWarns(DeprecationWarning):
deprecated_packages = repository.find_sorted_packages("numpy")
self.assertEqual([p.version for p in deprecated_packages], r_versions)
示例2: test_sorted_packages_invalid
# 需要导入模块: from enstaller.repository import Repository [as 别名]
# 或者: from enstaller.repository.Repository import find_sorted_packages [as 别名]
def test_sorted_packages_invalid(self):
# Given
entries = [
dummy_installed_package_factory("numpy", "1.6.1", 1),
dummy_installed_package_factory("numpy", "1.8k", 2),
]
repository = Repository()
for entry in entries:
repository.add_package(entry)
# When
packages = repository.find_sorted_packages("numpy")
# Then
self.assertEqual(len(packages), 2)
assertCountEqual(self, [p.version for p in packages],
[EnpkgVersion.from_string(v)
for v in ("1.6.1-1", "1.8k-2")])