Esempio n. 1
0
 def test_sequence(self):
     yaml = YAML()
     yaml.brace_single_entry_mapping_in_flow_sequence = True
     yaml.mapping_value_align = True
     yaml.round_trip("""
     - !Sequence [a, {b: 1}, {c: {d: 3}}]
     """)
Esempio n. 2
0
 def test_02(self):
     yaml = YAML()
     yaml.indent(mapping=5, sequence=6, offset=3)
     inp = """
     a:
          b:
             -  1
             -  [1, 2]
     """
     yaml.round_trip(inp)
Esempio n. 3
0
 def test_01(self):
     yaml = YAML()
     yaml.indent(sequence=6)
     yaml.indent(offset=3)
     inp = """
     a:
        -  1
        -  {b: 3}
     """
     yaml.round_trip(inp)
Esempio n. 4
0
 def test_04(self):
     yaml = YAML()
     yaml.indent(mapping=5, sequence=6)
     inp = """
     a:
          b:
          -     1
          -     [1, 2]
          -     {d: 3.14}
     """
     yaml.round_trip(inp)
Esempio n. 5
0
 def test_00(self):
     # old style
     yaml = YAML()
     yaml.indent = 6
     yaml.block_seq_indent = 3
     inp = """
     a:
        -  1
        -  [1, 2]
     """
     yaml.round_trip(inp)
Esempio n. 6
0
 def test_issue_249(self):
     yaml = YAML()
     inp = dedent("""\
     # comment
     -
       - 1
       - 2
       - 3
     """)
     exp = dedent("""\
     # comment
     - - 1
       - 2
       - 3
     """)
     yaml.round_trip(inp, outp=exp)  # NOQA
Esempio n. 7
0
 def test_issue_51(self):
     yaml = YAML()
     # yaml.map_indent = 2 # the default
     yaml.indent(sequence=4, offset=2)
     yaml.preserve_quotes = True
     yaml.round_trip("""
     role::startup::author::rsyslog_inputs:
       imfile:
         - ruleset: 'AEM-slinglog'
           File: '/opt/aem/author/crx-quickstart/logs/error.log'
           startmsg.regex: '^[-+T.:[:digit:]]*'
           tag: 'error'
         - ruleset: 'AEM-slinglog'
           File: '/opt/aem/author/crx-quickstart/logs/stdout.log'
           startmsg.regex: '^[-+T.:[:digit:]]*'
           tag: 'stdout'
     """)
Esempio n. 8
0
 def test_sequence2(self):
     yaml = YAML()
     yaml.mapping_value_align = True
     yaml.round_trip("""
     - !Sequence [a, b: 1, c: {d: 3}]
     """)
Esempio n. 9
0
 def rt(self, yaml):
     return yaml.round_trip()
Esempio n. 10
0
 def rt(self, yaml):
     return yaml.round_trip()