summaryrefslogtreecommitdiff
path: root/tests/internals
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-18 11:05:52 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-15 14:14:03 +0000
commit8bfe8dd6ad49445c900662f304072eb20f0ff606 (patch)
tree07e04ff71c848692acb8f0f2d866449672fe0031 /tests/internals
parent1aa0fb1fefa7e86586831a13200a92f6dd9bd3b4 (diff)
downloadbuildstream-8bfe8dd6ad49445c900662f304072eb20f0ff606.tar.gz
_yaml: Remove 'node_set'. Now use __setitem__
- Implement __setitem__ on 'MappingNode' - Implement __setitem__ on 'SequenceNode' - Adapt all call sites to use the new calling way.
Diffstat (limited to 'tests/internals')
-rw-r--r--tests/internals/yaml.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/internals/yaml.py b/tests/internals/yaml.py
index 0df058d62..1857a1b76 100644
--- a/tests/internals/yaml.py
+++ b/tests/internals/yaml.py
@@ -127,7 +127,7 @@ def test_node_set(datafiles):
base = _yaml.load(filename)
assert 'mother' not in base
- _yaml.node_set(base, 'mother', 'snow white')
+ base['mother'] = 'snow white'
assert base.get_str('mother') == 'snow white'
@@ -142,12 +142,12 @@ def test_node_set_overwrite(datafiles):
# Overwrite a string
assert base.get_str('kind') == 'pony'
- _yaml.node_set(base, 'kind', 'cow')
+ base['kind'] = 'cow'
assert base.get_str('kind') == 'cow'
# Overwrite a list as a string
assert base.get_sequence('moods').as_str_list() == ['happy', 'sad']
- _yaml.node_set(base, 'moods', 'unemotional')
+ base['moods'] = 'unemotional'
assert base.get_str('moods') == 'unemotional'
@@ -161,8 +161,7 @@ def test_node_set_list_element(datafiles):
base = _yaml.load(filename)
assert base.get_sequence('moods').as_str_list() == ['happy', 'sad']
-
- _yaml.node_set(base, 'moods', 'confused', indices=[0])
+ base.get_sequence('moods')[0] = 'confused'
assert base.get_sequence('moods').as_str_list() == ['confused', 'sad']