summaryrefslogtreecommitdiff
path: root/tests/format/include.py
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-10 07:51:57 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:02 +0000
commit38671fb53f4522d046bed94699db8cc344ac2862 (patch)
treedc75c432d897d393d3a568290d45d762c7bde093 /tests/format/include.py
parentfcef3658433f74a2f396ed353bb3534f0001f3d8 (diff)
downloadbuildstream-38671fb53f4522d046bed94699db8cc344ac2862.tar.gz
_yaml: Add 'as_str()' on ScalarNode and 'get_scalar()' on MappingNode
- 'get_scalar()' allows retrieving a scalar node from a mapping. - 'as_str()' casts a ScalarNode into a string (thus removing the node information). Both together, those replace 'node_get(mapping, key, type=str)' but also allow retrieving the 'Node' itself, which will allow in the future lazier provenance computation.
Diffstat (limited to 'tests/format/include.py')
-rw-r--r--tests/format/include.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/format/include.py b/tests/format/include.py
index f2815ca31..82667f19f 100644
--- a/tests/format/include.py
+++ b/tests/format/include.py
@@ -102,7 +102,7 @@ def test_include_junction_options(cli, datafiles):
'element.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'build_arch') == 'x86_64'
+ assert loaded.get_str('build_arch') == 'x86_64'
@pytest.mark.datafiles(DATA_DIR)
@@ -135,7 +135,7 @@ def test_junction_element_partial_project_project(cli, tmpdir, datafiles):
'junction.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'included', default_value=None) is None
+ assert loaded.get_str('included', default=None) is None
@pytest.mark.datafiles(DATA_DIR)
@@ -168,7 +168,7 @@ def test_junction_element_not_partial_project_file(cli, tmpdir, datafiles):
'junction.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'included', default_value=None) is not None
+ assert loaded.get_str('included', default=None) is not None
@pytest.mark.datafiles(DATA_DIR)
@@ -182,8 +182,8 @@ def test_include_element_overrides(cli, datafiles):
'element.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'manual_main_override', default_value=None) is not None
- assert _yaml.node_get(loaded, str, 'manual_included_override', default_value=None) is not None
+ assert loaded.get_str('manual_main_override', default=None) is not None
+ assert loaded.get_str('manual_included_override', default=None) is not None
@pytest.mark.datafiles(DATA_DIR)
@@ -229,7 +229,7 @@ def test_include_element_overrides_sub_include(cli, datafiles):
'element.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'included', default_value=None) is not None
+ assert loaded.get_str('included', default=None) is not None
@pytest.mark.datafiles(DATA_DIR)
@@ -248,8 +248,8 @@ def test_junction_do_not_use_included_overrides(cli, tmpdir, datafiles):
'junction.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'main_override', default_value=None) is not None
- assert _yaml.node_get(loaded, str, 'included_override', default_value=None) is None
+ assert loaded.get_str('main_override', default=None) is not None
+ assert loaded.get_str('included_override', default=None) is None
@pytest.mark.datafiles(DATA_DIR)
@@ -264,7 +264,7 @@ def test_conditional_in_fragment(cli, datafiles):
'element.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'size') == '8'
+ assert loaded.get_str('size') == '8'
@pytest.mark.datafiles(DATA_DIR)
@@ -278,7 +278,7 @@ def test_inner(cli, datafiles):
'element.bst'])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert _yaml.node_get(loaded, str, 'build_arch') == 'x86_64'
+ assert loaded.get_str('build_arch') == 'x86_64'
@pytest.mark.datafiles(DATA_DIR)