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


Python Spec.eq_dag方法代码示例

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


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

示例1: test_copy_simple

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
    def test_copy_simple(self):
        orig = Spec('mpileaks')
        copy = orig.copy()
        check_links(copy)

        assert orig == copy
        assert orig.eq_dag(copy)
        assert orig._normal == copy._normal
        assert orig._concrete == copy._concrete

        # ensure no shared nodes bt/w orig and copy.
        orig_ids = set(id(s) for s in orig.traverse())
        copy_ids = set(id(s) for s in copy.traverse())
        assert not orig_ids.intersection(copy_ids)
开发者ID:justintoo,项目名称:spack,代码行数:16,代码来源:spec_dag.py

示例2: test_copy_simple

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
    def test_copy_simple(self):
        orig = Spec('mpileaks')
        copy = orig.copy()

        self.check_links(copy)

        self.assertEqual(orig, copy)
        self.assertTrue(orig.eq_dag(copy))
        self.assertEqual(orig._normal, copy._normal)
        self.assertEqual(orig._concrete, copy._concrete)

        # ensure no shared nodes bt/w orig and copy.
        orig_ids = set(id(s) for s in orig.traverse())
        copy_ids = set(id(s) for s in copy.traverse())
        self.assertFalse(orig_ids.intersection(copy_ids))
开发者ID:jgalarowicz,项目名称:spack,代码行数:17,代码来源:spec_dag.py

示例3: test_equal

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
    def test_equal(self):
        # Different spec structures to test for equality
        flat = Spec('mpileaks ^callpath ^libelf ^libdwarf')

        flat_init = Spec(
            'mpileaks', Spec('callpath'), Spec('libdwarf'), Spec('libelf'))

        flip_flat = Spec(
            'mpileaks', Spec('libelf'), Spec('libdwarf'), Spec('callpath'))

        dag = Spec('mpileaks', Spec('callpath',
                                    Spec('libdwarf',
                                         Spec('libelf'))))

        flip_dag = Spec('mpileaks', Spec('callpath',
                                         Spec('libelf',
                                              Spec('libdwarf'))))

        # All these are equal to each other with regular ==
        specs = (flat, flat_init, flip_flat, dag, flip_dag)
        for lhs, rhs in zip(specs, specs):
            self.assertEqual(lhs, rhs)
            self.assertEqual(str(lhs), str(rhs))

        # Same DAGs constructed different ways are equal
        self.assertTrue(flat.eq_dag(flat_init))

        # order at same level does not matter -- (dep on same parent)
        self.assertTrue(flat.eq_dag(flip_flat))

        # DAGs should be unequal if nesting is different
        self.assertFalse(flat.eq_dag(dag))
        self.assertFalse(flat.eq_dag(flip_dag))
        self.assertFalse(flip_flat.eq_dag(dag))
        self.assertFalse(flip_flat.eq_dag(flip_dag))
        self.assertFalse(dag.eq_dag(flip_dag))
开发者ID:jgalarowicz,项目名称:spack,代码行数:38,代码来源:spec_dag.py

示例4: test_normalize

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
def test_normalize(spec_and_expected, config, builtin_mock):
    spec, expected = spec_and_expected
    spec = Spec(spec)
    spec.normalize()
    assert spec.eq_dag(expected, deptypes=False)
开发者ID:alfredo-gimenez,项目名称:spack,代码行数:7,代码来源:optional_deps.py

示例5: check_normalize

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
 def check_normalize(self, spec_string, expected):
     spec = Spec(spec_string)
     spec.normalize()
     self.assertEqual(spec, expected)
     self.assertTrue(spec.eq_dag(expected))
开发者ID:d-tk,项目名称:spack,代码行数:7,代码来源:optional_deps.py

示例6: test_normalize_mpileaks

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
    def test_normalize_mpileaks(self):
        # Spec parsed in from a string
        spec = Spec('mpileaks ^mpich ^callpath ^dyninst ^[email protected] ^libdwarf')

        # What that spec should look like after parsing
        expected_flat = Spec(
            'mpileaks', Spec('mpich'), Spec('callpath'), Spec('dyninst'),
            Spec('[email protected]'), Spec('libdwarf'))

        # What it should look like after normalization
        mpich = Spec('mpich')
        libelf = Spec('[email protected]')
        expected_normalized = Spec(
            'mpileaks',
            Spec('callpath',
                 Spec('dyninst',
                      Spec('libdwarf',
                           libelf),
                      libelf),
                 mpich),
            mpich)

        # Similar to normalized spec, but now with copies of the same
        # libelf node.  Normalization should result in a single unique
        # node for each package, so this is the wrong DAG.
        non_unique_nodes = Spec(
            'mpileaks',
            Spec('callpath',
                 Spec('dyninst',
                      Spec('libdwarf',
                           Spec('[email protected]')),
                      Spec('[email protected]')),
                 mpich),
            Spec('mpich'))

        # All specs here should be equal under regular equality
        specs = (spec, expected_flat, expected_normalized, non_unique_nodes)
        for lhs, rhs in zip(specs, specs):
            self.assertEqual(lhs, rhs)
            self.assertEqual(str(lhs), str(rhs))

        # Test that equal and equal_dag are doing the right thing
        self.assertEqual(spec, expected_flat)
        self.assertTrue(spec.eq_dag(expected_flat))

        self.assertEqual(spec, expected_normalized)
        self.assertFalse(spec.eq_dag(expected_normalized))

        self.assertEqual(spec, non_unique_nodes)
        self.assertFalse(spec.eq_dag(non_unique_nodes))

        spec.normalize()

        # After normalizing, spec_dag_equal should match the normalized spec.
        self.assertEqual(spec, expected_flat)
        self.assertFalse(spec.eq_dag(expected_flat))

        self.assertEqual(spec, expected_normalized)
        self.assertTrue(spec.eq_dag(expected_normalized))

        self.assertEqual(spec, non_unique_nodes)
        self.assertFalse(spec.eq_dag(non_unique_nodes))
开发者ID:jgalarowicz,项目名称:spack,代码行数:64,代码来源:spec_dag.py

示例7: test_normalize_mpileaks

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
    def test_normalize_mpileaks(self):
        # Spec parsed in from a string
        spec = Spec('mpileaks ^mpich ^callpath ^dyninst ^[email protected]'
                    ' ^libdwarf')

        # What that spec should look like after parsing
        expected_flat = Spec(
            'mpileaks', Spec('mpich'), Spec('callpath'), Spec('dyninst'),
            Spec('[email protected]'), Spec('libdwarf'))

        # What it should look like after normalization
        mpich = Spec('mpich')
        libelf = Spec('[email protected]')
        expected_normalized = Spec(
            'mpileaks',
            Spec('callpath',
                 Spec('dyninst',
                      Spec('libdwarf',
                           libelf),
                      libelf),
                 mpich),
            mpich)

        # Similar to normalized spec, but now with copies of the same
        # libelf node.  Normalization should result in a single unique
        # node for each package, so this is the wrong DAG.
        non_unique_nodes = Spec(
            'mpileaks',
            Spec('callpath',
                 Spec('dyninst',
                      Spec('libdwarf',
                           Spec('[email protected]')),
                      Spec('[email protected]')),
                 mpich),
            Spec('mpich'))

        # All specs here should be equal under regular equality
        specs = (spec, expected_flat, expected_normalized, non_unique_nodes)
        for lhs, rhs in zip(specs, specs):
            assert lhs == rhs
            assert str(lhs) == str(rhs)

        # Test that equal and equal_dag are doing the right thing
        assert spec == expected_flat
        assert spec.eq_dag(expected_flat)

        # Normalized has different DAG structure, so NOT equal.
        assert spec != expected_normalized
        assert not spec.eq_dag(expected_normalized)

        # Again, different DAG structure so not equal.
        assert spec != non_unique_nodes
        assert not spec.eq_dag(non_unique_nodes)

        spec.normalize()

        # After normalizing, spec_dag_equal should match the normalized spec.
        assert spec != expected_flat
        assert not spec.eq_dag(expected_flat)

        # verify DAG structure without deptypes.
        assert spec.eq_dag(expected_normalized, deptypes=False)
        assert not spec.eq_dag(non_unique_nodes, deptypes=False)

        assert not spec.eq_dag(expected_normalized, deptypes=True)
        assert not spec.eq_dag(non_unique_nodes, deptypes=True)
开发者ID:justintoo,项目名称:spack,代码行数:68,代码来源:spec_dag.py

示例8: test_normalize

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import eq_dag [as 别名]
def test_normalize(spec_and_expected, config, mock_packages):
    spec, expected = spec_and_expected
    spec = Spec(spec)
    spec.normalize()
    assert spec.eq_dag(expected, deptypes=False)
开发者ID:LLNL,项目名称:spack,代码行数:7,代码来源:optional_deps.py


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