Пример #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}}]
     """)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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
Пример #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'
     """)
Пример #8
0
 def test_sequence2(self):
     yaml = YAML()
     yaml.mapping_value_align = True
     yaml.round_trip("""
     - !Sequence [a, b: 1, c: {d: 3}]
     """)
Пример #9
0
 def rt(self, yaml):
     return yaml.round_trip()
Пример #10
0
 def rt(self, yaml):
     return yaml.round_trip()