summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-12-11 00:01:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-12-11 00:01:03 (GMT)
commit700425c7d1e884882603eb49cec2a6a6c4118686 (patch)
treecc451fbd6d0611edf49e1c4368adc8c1a8ef30b0 /tests
parent48395d4471d87c20bdbd06bbab1ae3af938ff823 (diff)
Improved the search of Yaml nodes.
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/yamlrdr.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/plugins/yamlrdr.py b/tests/plugins/yamlrdr.py
index 2f2694b..e09bb21 100644
--- a/tests/plugins/yamlrdr.py
+++ b/tests/plugins/yamlrdr.py
@@ -99,7 +99,7 @@ root:
f.close()
- def testSimpleYamlContent(self):
+ def XXXtestSimpleYamlContent(self):
"""Validate Yaml content readers."""
def _build_node_desc(node, left, extra = ''):
@@ -158,7 +158,7 @@ root:
self.assertEqual('\n' + fulldesc + '\n', self._mixed_data.decode('ascii'))
- def testSimpleYamlContentFinder(self):
+ def XXXtestSimpleYamlContentFinder(self):
"""Validate Yaml nested content search."""
reader = YamlReader.new_from_path(self._nested.name)
@@ -236,6 +236,24 @@ root:
if len(found) == 1:
self.assertEqual(found[0].yaml_line.key, 'root')
+ found = reader.tree.find_by_path('/root/', True)
+
+ self.assertEqual(len(found), 1)
+
+ found = reader.tree.find_one_by_path('/root/', True)
+
+ self.assertIsNotNone(found)
+
+ if found:
+
+ sub = found.find_one_by_path('/a')
+ self.assertIsNotNone(sub)
+ self.assertEqual(sub.yaml_line.key, 'a')
+
+ sub = found.find_one_by_path('/aa')
+ self.assertIsNotNone(sub)
+ self.assertEqual(sub.yaml_line.key, 'aa')
+
found = reader.tree.find_by_path('/root/')
self.assertEqual(len(found), 2)