Ejemplo n.º 1
0
    def test_patch_empty(self):
        content = trim_docstring("""
        """,
                                 strip_leading=True,
                                 as_string=False)

        patcher = LinePatcher()
        assert patcher.patch(content) is content
Ejemplo n.º 2
0
 def test_patch_indented(self, patches, expected):
     patcher = LinePatcher()
     for p in patches:
         patcher.add(p)
     assert '\n'.join(patcher.patch(
         self.content_indented)) == trim(expected)
Ejemplo n.º 3
0
 def test_insert_after(self, patches, expected):
     patcher = LinePatcher()  # Insert after the line is default.
     for p in patches:
         patcher.add(p)
     assert '\n'.join(patcher.patch(self.content)) == trim(expected)
Ejemplo n.º 4
0
 def test_insert_before(self, patches, expected):
     patcher = LinePatcher(insert_after=False)
     for p in patches:
         patcher.add(p)
     assert '\n'.join(patcher.patch(self.content)) == trim(expected)