예제 #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
파일: yaml.py 프로젝트: blau08/churchbook
 def rt(self, yaml):
     return yaml.round_trip()