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


Python MatchSpec.merge方法代码示例

本文整理汇总了Python中conda.models.match_spec.MatchSpec.merge方法的典型用法代码示例。如果您正苦于以下问题:Python MatchSpec.merge方法的具体用法?Python MatchSpec.merge怎么用?Python MatchSpec.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在conda.models.match_spec.MatchSpec的用法示例。


在下文中一共展示了MatchSpec.merge方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_merge_single_name

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_merge_single_name(self):
        specs = (MatchSpec('exact'), MatchSpec('exact 1.2.3 1'), MatchSpec('exact >1.0,<2'))
        merged_specs = MatchSpec.merge(specs)
        print(merged_specs)
        assert len(merged_specs) == 1
        merged_spec = merged_specs[0]
        print(merged_spec)
        assert str(merged_spec) == "exact[version='1.2.3,>1.0,<2',build=1]"
        assert merged_spec.match({
            'name': 'exact',
            'version': '1.2.3',
            'build': '1',
            'build_number': 1,
        })
        assert not merged_spec.match({
            'name': 'exact',
            'version': '1.2.2',
            'build': '1',
            'build_number': 1,
        })

        specs = (MatchSpec('exact 1.2.3 1'), MatchSpec('exact 1.2.3 2'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)

        merged_specs = MatchSpec.merge((MatchSpec('exact 1.2.3 1'),))
        assert len(merged_specs) == 1
        assert str(merged_specs[0]) == "exact==1.2.3=1"
开发者ID:njalerikson,项目名称:conda,代码行数:30,代码来源:test_match_spec.py

示例2: test_md5_merge_with_name

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_md5_merge_with_name(self):
        specs = (MatchSpec('python[md5=deadbeef]'), MatchSpec('python=1.2.3'), MatchSpec('conda-forge::python[md5=deadbeef]'))
        merged = MatchSpec.merge(specs)
        assert len(merged) == 1
        assert str(merged[0]) == "conda-forge::python=1.2.3[md5=deadbeef]"

        specs = (MatchSpec('python[md5=FFBADD11]'), MatchSpec('python=1.2.3'), MatchSpec('python[md5=ffbadd11]'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)
开发者ID:njalerikson,项目名称:conda,代码行数:11,代码来源:test_match_spec.py

示例3: test_build_number_merge

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_build_number_merge(self):
        specs = (MatchSpec('python[build_number=1]'), MatchSpec('python=1.2.3=py27_7'), MatchSpec('conda-forge::python<=8[build_number=1]'))
        merged = MatchSpec.merge(specs)
        assert len(merged) == 1
        assert str(merged[0]) == "conda-forge::python[version='1.2.3,<=8',build=py27_7,build_number=1]"

        specs = (MatchSpec('python[build_number=2]'), MatchSpec('python=1.2.3=py27_7'), MatchSpec('python<=8[build_number=1]'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)
开发者ID:njalerikson,项目名称:conda,代码行数:11,代码来源:test_match_spec.py

示例4: test_subdir_merge

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_subdir_merge(self):
        specs = (MatchSpec('pkgs/main/linux-64::python'), MatchSpec('pkgs/main/linux-32::python'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)

        specs = (MatchSpec('defaults/win-32::python'), MatchSpec('defaults/win-64::python'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)

        specs = (MatchSpec('pkgs/free/linux-64::python'), MatchSpec('pkgs/free::python 1.2.3'))
        merged = MatchSpec.merge(specs)
        assert len(merged) == 1
        assert str(merged[0]) == "pkgs/free/linux-64::python==1.2.3"
        assert merged[0] == MatchSpec(channel='pkgs/free', subdir='linux-64', name='python', version='1.2.3')
开发者ID:njalerikson,项目名称:conda,代码行数:16,代码来源:test_match_spec.py

示例5: test_merge_multiple_name

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_merge_multiple_name(self):
        specs = tuple(MatchSpec(s) for s in (
            'exact', 'exact 1.2.3 1',
            'bounded >=1.0,<2.0', 'bounded >=1.5', 'bounded <=1.8',
            'exact >1.0,<2',
        ))
        merged_specs = MatchSpec.merge(specs)
        print(merged_specs)
        assert len(merged_specs) == 2

        exact_spec = next(s for s in merged_specs if s.name == 'exact')
        bounded_spec = next(s for s in merged_specs if s.name == 'bounded')

        assert str(exact_spec) == "exact[version='1.2.3,>1.0,<2',build=1]"
        assert str(bounded_spec) == "bounded[version='>=1.0,<2.0,>=1.5,<=1.8']"

        assert not bounded_spec.match({
            'name': 'bounded',
            'version': '1',
            'build': '6',
            'build_number': 6,
        })
        assert bounded_spec.match({
            'name': 'bounded',
            'version': '1.5',
            'build': '7',
            'build_number': 7,
        })
        assert not bounded_spec.match({
            'name': 'bounded',
            'version': '2',
            'build': '8',
            'build_number': 8,
        })
开发者ID:njalerikson,项目名称:conda,代码行数:36,代码来源:test_match_spec.py

示例6: test_md5_merge_wo_name

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
 def test_md5_merge_wo_name(self):
     specs = (MatchSpec('*[md5=deadbeef]'), MatchSpec('*[md5=FFBADD11]'))
     merged = MatchSpec.merge(specs)
     assert len(merged) == 2
     str_specs = ('*[md5=deadbeef]', '*[md5=FFBADD11]')
     assert str(merged[0]) in str_specs
     assert str(merged[1]) in str_specs
     assert str(merged[0]) != str(merged[1])
开发者ID:njalerikson,项目名称:conda,代码行数:10,代码来源:test_match_spec.py

示例7: test_channel_merge

# 需要导入模块: from conda.models.match_spec import MatchSpec [as 别名]
# 或者: from conda.models.match_spec.MatchSpec import merge [as 别名]
    def test_channel_merge(self):
        specs = (MatchSpec('pkgs/main::python'), MatchSpec('defaults::python'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)

        specs = (MatchSpec('defaults::python'), MatchSpec('pkgs/main::python'))
        with pytest.raises(ValueError):
            MatchSpec.merge(specs)

        specs = (MatchSpec('defaults::python'), MatchSpec('defaults::python 1.2.3'))
        merged = MatchSpec.merge(specs)
        assert len(merged) == 1
        assert str(merged[0]) == "defaults::python==1.2.3"

        specs = (MatchSpec('pkgs/free::python'), MatchSpec('pkgs/free::python 1.2.3'))
        merged = MatchSpec.merge(specs)
        assert len(merged) == 1
        assert str(merged[0]) == "pkgs/free::python==1.2.3"
开发者ID:njalerikson,项目名称:conda,代码行数:20,代码来源:test_match_spec.py


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