Example #1
0
 def test_issue_25_01(self):
     round_trip("""\
     a:        # comment 1
               #  comment 2
     - b:      #   comment 3
         c: 1  #    comment 4
     """)
Example #2
0
 def test_issue_25a1(self):
     round_trip("""\
     - a: b
       c: d
       d:  # foo
         e: f
     """)
Example #3
0
 def test_issue_25c(self):
     round_trip("""\
     params:
       a: 1 # comment a
       b:   # comment b
       c: 3 # comment c
     """)
Example #4
0
 def test_issue_93_00(self):
     round_trip("""\
     a:
     - - c1: cat   # a1
       # my comment on catfish
       - c2: catfish  # a2
     """)
Example #5
0
 def test_issue_93_02(self):
     # never failed as there is no indent
     round_trip("""\
     - c1: cat
     # my comment on catfish
     - c2: catfish
     """)
Example #6
0
 def test_dropped(self):
     s = """\
     # comment
     scalar
     ...
     """
     round_trip(s, 'scalar\n...\n')
Example #7
0
    def test_embedded_map(self):
        round_trip("""
        - a: 1y
          b: 2y

          c: 3y
        """)
Example #8
0
    def test_blank_line_after_comment(self):
        round_trip("""
        # Comment with spaces after it.


        a: 1
        """)
Example #9
0
 def test_normal_timezone(self):
     round_trip("""
     - 2011-10-02T11:45:00-5
     - 2011-10-02 11:45:00-5
     - 2011-10-02T11:45:00-05:00
     - 2011-10-02 11:45:00-05:00
     """)
Example #10
0
 def test_issue_25b(self):
     round_trip(
         """\
     var1: #empty
     var2: something #notempty
     """
     )
Example #11
0
 def test_issue_25_03(self):
     s = """\
     a:        # comment 1
               #  comment 2
       - b: 2  #   comment 3
     """
     round_trip(s, indent=4, block_seq_indent=2)
Example #12
0
 def test_full_tag(self):
     round_trip("""\
     !!tag:yaml.org,2002:python/object:__main__.Developer
     name: Anthon
     location: Germany
     language: python
     """)
Example #13
0
 def test_comment_after_block_scalar_indicator(self):
     round_trip("""\
     a: | # abc
       test 1
       test 2
     # all done
     """)
Example #14
0
 def test_dropped(self):
     round_trip(
         """
     # comment
     scalar
     ...
     """, "scalar\n...\n")
Example #15
0
 def test_standard_short_tag(self):
     round_trip("""\
     !!map
     name: Anthon
     location: Germany
     language: python
     """)
Example #16
0
 def test_no_comments(self):
     round_trip("""
     - europe: 10
     - usa:
       - ohio: 2
       - california: 9
     """)
Example #17
0
 def test_complex(self):
     round_trip("""
     - europe: 10 # top
     - usa:
       - ohio: 2
       - california: 9 # o
     """)
Example #18
0
 def test_map_in_map_0(self):
     round_trip("""
     map1: # comment 1
       # comment 2
       map2:
         key1: val1
     """)
Example #19
0
 def test_tag(self):
     round_trip("""\
     !!python/object:__main__.Developer
     name: Anthon
     location: Germany
     language: python
     """)
Example #20
0
 def test_Y2(self):
     round_trip("""\
     !!yyy
     name: Anthon
     location: Germany
     language: python
     """)
Example #21
0
 def test_simple_map_middle_comment(self):
     round_trip("""
     abc: 1
     # C 3a
     # C 3b
     ghi: 2
     """)
Example #22
0
 def test_standard_tag(self):
     round_trip("""\
     !!tag:yaml.org,2002:python/object:map
     name: Anthon
     location: Germany
     language: python
     """)
Example #23
0
 def test_preserve_string(self):
     inp = """
     a: |
       abc
       def
     """
     round_trip(inp, intermediate=dict(a='abc\ndef\n'))
Example #24
0
 def test_omap_comment_roundtrip(self):
     round_trip("""
     !!omap
     - a: 1
     - b: 2  # two
     - c: 3  # three
     - d: 4
     """)
Example #25
0
 def test_no_end_of_file_eol(self):
     """not excluding comments caused some problems if at the end of
     the file without a newline. First error, then included \0 """
     x = """\
     - europe: 10 # abc"""
     round_trip(x, extra='\n')
     with pytest.raises(AssertionError):
         round_trip(x, extra='a\n')
Example #26
0
 def test_X1(self):
     register_xxx()
     round_trip("""\
     !xxx
     name: Anthon
     location: Germany
     language: python
     """)
Example #27
0
    def test_preserve_string_strip(self):
        s = """
            a: |-
              abc
              def

            """
        round_trip(s, intermediate=dict(a='abc\ndef'))
Example #28
0
 def test_map_in_map_1(self):
     # comment is moved from value to key
     round_trip("""
     map1:
       # comment 1
       map2:
         key1: val1
     """)
Example #29
0
    def test_fold_string_keep(self):
        with pytest.raises(AssertionError) as excinfo:  # NOQA
            round_trip("""
            a: >+
              abc
              def

            """, intermediate=dict(a='abc def\n\n'))
Example #30
0
 def test_single_doc_begin_end(self):
     inp = """\
     ---
     - a
     - b
     ...
     """
     round_trip(inp, explicit_start=True, explicit_end=True)