You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/01/25 02:17:13 UTC
[buildstream] 06/06: tests/internals/yaml.py: Test
MappingNode.get_str_list() with default None
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/yaml-fixes
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 6018196b09fc9d265510bd9c9cbddc72de86ab60
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Sun Jan 24 13:32:05 2021 +0900
tests/internals/yaml.py: Test MappingNode.get_str_list() with default None
---
tests/internals/yaml.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/internals/yaml.py b/tests/internals/yaml.py
index b577c7e..2b59619 100644
--- a/tests/internals/yaml.py
+++ b/tests/internals/yaml.py
@@ -502,3 +502,14 @@ def test_get_str_list_invalid(datafiles, filename, provenance):
strings = base.get_str_list("list")
assert exc.value.reason == LoadErrorReason.INVALID_DATA
assert provenance in str(exc.value)
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
+def test_get_str_list_default_none(datafiles):
+ conf_file = os.path.join(datafiles.dirname, datafiles.basename, "list-of-dict.yaml")
+
+ base = _yaml.load(conf_file, shortname=None)
+
+ # There is no "pony" key here, assert that the default return is smooth
+ strings = base.get_str_list("pony", None)
+ assert strings == None