diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-03-11 22:45:00 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-03-11 22:45:00 (GMT) |
commit | f07044dab60fcd74ee32f4f959f7c2a233153bfa (patch) | |
tree | 91e29972dc4b921e2de325bfb4435dad0cfcb2e6 /tests/plugins | |
parent | 539461d29e744d046b6dfa18ccc078a55c86b1d8 (diff) |
Handle YAML nodes without values.
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/yamlrdr.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/plugins/yamlrdr.py b/tests/plugins/yamlrdr.py index b9a99a2..dbd9651 100644 --- a/tests/plugins/yamlrdr.py +++ b/tests/plugins/yamlrdr.py @@ -4,7 +4,6 @@ from chrysacase import ChrysalideTestCase from pychrysalide.plugins.yaml import YamlReader -import tempfile class TestYamlReader(ChrysalideTestCase): @@ -234,3 +233,29 @@ root: sub = found[0].find_one_by_path('/aa') self.assertIsNotNone(sub) self.assertEqual(sub.key, 'aa') + + + def testItemsWithoutValue(self): + """Find items without values.""" + + from pychrysalide import core + core.set_verbosity(5) + + data = ''' +vals: + - 1 + - 2 + - 3 + +''' + + reader = YamlReader(text=data) + self.assertIsNotNone(reader) + + found = reader.tree.find_by_path('/vals/') + + self.assertEqual(len(found), 3) + + self.assertEqual(found[0].nodes[0].key, '1') + self.assertEqual(found[1].nodes[0].key, '2') + self.assertEqual(found[2].nodes[0].key, '3') |