diff options
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/yaml.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/plugins/yaml.py b/tests/plugins/yaml.py index 2fbb0bd..4d2680c 100644 --- a/tests/plugins/yaml.py +++ b/tests/plugins/yaml.py @@ -146,3 +146,30 @@ root: found = root.find_first_by_path('/root/d') self.assertEqual(found.value, "'xx::xx'") + + + def testArrayAsSeq(self): + """Handle array as YAML block sequence.""" + + definitions = ''' +root: + a: [ a, 'b', 0xcc, "\td\n\\"'" ] +''' + + root = yaml.parse_from_text(definitions) + + found = root.find_first_by_path('/root/a') + + self.assertIsNone(found.value) + + self.assertEqual(len(found.children.nodes), 4) + + self.assertEqual(found.children.nodes[0].key, 'a') + + self.assertEqual(found.children.nodes[1].key, 'b') + + self.assertEqual(found.children.nodes[2].key, '0xcc') + + self.assertEqual(found.children.nodes[3].key, "\td \"'") + + self.assertEqual(found.aggregate_value(), '[ a, \'b\', 0xcc, " d \"\'" ]') |