Ejemplo n.º 1
0
    def test_checks_ignores_blank_lines(self):
        actual_contents = dedent("""
            line 1
            line 2


            line 3


            line 4
            line 5
            """)
        listing = CodeListing(filename='file2.txt',
                              contents=dedent("""
            line 1
            line 2

            line 3

            line 4
            """).lstrip())
        listing.currentcontents = True
        self.check_current_contents(listing,
                                    actual_contents)  # should not raise

        listing2 = CodeListing(filename='file2.txt',
                               contents=dedent("""
            line 1
            line 2
            line 3

            line 4
            """).lstrip())
        with self.assertRaises(AssertionError):
            self.check_current_contents(listing2, actual_contents)
Ejemplo n.º 2
0
    def test_raises_if_lines_not_in_order(self):
        actual_contents = dedent("""
            line 1
            line 2
            line 3
            line 4
            """)
        listing = CodeListing(filename='file2.txt',
                              contents=dedent("""
            line 1
            line 3
            line 2
            """).lstrip())
        listing.currentcontents = True

        with self.assertRaises(AssertionError):
            self.check_current_contents(listing, actual_contents)
Ejemplo n.º 3
0
 def test_checks_elipsis_blocks_separately(self):
     actual_contents = dedent("""
         line 1
         line 2
         line 3
         line 4
         line 5
         """)
     listing = CodeListing(filename='file2.txt',
                           contents=dedent("""
         line 1
         line 2
         [...]
         line 4
         """).lstrip())
     listing.currentcontents = True
     self.check_current_contents(listing,
                                 actual_contents)  # should not raise