本文整理汇总了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)
示例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))
示例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))
示例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)
示例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))
示例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))
示例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)
示例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)