summaryrefslogtreecommitdiff
path: root/tests/internals
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-09 14:22:35 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:02 +0000
commitfcef3658433f74a2f396ed353bb3534f0001f3d8 (patch)
treea3c74347254332f06583fbdc1c6a6fc4411d21aa /tests/internals
parentf6616bc9d51a791aba1e177c61e27f768bebd9cb (diff)
downloadbuildstream-fcef3658433f74a2f396ed353bb3534f0001f3d8.tar.gz
_yaml: add 'get_mapping()' to MappingNode
This allows to get a mapping node from another 'MappingNode', replacing 'node_get(my_mapping, key, type=dict)' Also changes all places where 'node_get' was called like that by the new API.
Diffstat (limited to 'tests/internals')
-rw-r--r--tests/internals/yaml.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/internals/yaml.py b/tests/internals/yaml.py
index cd3bdc535..a553cbf0f 100644
--- a/tests/internals/yaml.py
+++ b/tests/internals/yaml.py
@@ -110,9 +110,9 @@ def test_node_get(datafiles):
child = _yaml.node_get(base, dict, 'children', indices=[6])
assert_provenance(filename, 20, 8, child, 'mood')
- extra = _yaml.node_get(base, dict, 'extra')
+ extra = base.get_mapping('extra')
with pytest.raises(LoadError) as exc:
- _yaml.node_get(extra, dict, 'old')
+ extra.get_mapping('old')
assert exc.value.reason == LoadErrorReason.INVALID_DATA
@@ -188,8 +188,8 @@ def test_composite_preserve_originals(datafiles):
base_copy = _yaml.node_copy(base)
_yaml.composite_dict(base_copy, overlay)
- copy_extra = _yaml.node_get(base_copy, dict, 'extra')
- orig_extra = _yaml.node_get(base, dict, 'extra')
+ copy_extra = base_copy.get_mapping('extra')
+ orig_extra = base.get_mapping('extra')
# Test that the node copy has the overridden value...
assert _yaml.node_get(copy_extra, str, 'old') == 'override'