Пример #1
0
    def test_all_indented(self):
        s = """\
        Docstring to test.

        foo bar
        """
        assert 'Docstring to test.\n\nfoo bar\n' == doc_dedent(s)
Пример #2
0
    def test_docstring(self):
        s = """Docstring to test.

        foo bar
        """
        assert 'Docstring to test.\n\nfoo bar\n' == doc_dedent(s)
Пример #3
0
 def test_indented_line(self):
     for indent in ('\t', '    '):
         s = f'{indent}line'
         assert 'line' == doc_dedent(s)
Пример #4
0
 def test_line(self):
     s = 'line'
     assert s == doc_dedent(s)
Пример #5
0
 def test_non_string(self):
     with pytest.raises(TypeError):
         doc_dedent(None)
Пример #6
0
 def test_empty(self):
     s = ''
     assert s == doc_dedent(s)