Ejemplo n.º 1
0
 def test_indenter_without_context_empty_line(self, mock_stdout):
     indenter = Indenter()
     indenter.print('abc')
     indenter.print()
     indenter.print('ghi')
     assert mock_stdout.getvalue() == 'abc\n\nghi\n'
Ejemplo n.º 2
0
 def test_indenter(self, mock_stdout):
     indenter = Indenter()
     indenter.print('abc')
     indenter.print()
     indenter.print('ghi')
     with indenter:
         indenter.print('jkl')
         with indenter:
             indenter.print('mno')
         indenter.print('pqi')
     indenter.print('stu')
     with indenter:
         indenter.print('vwx')
     assert (mock_stdout.getvalue() == 'abc\n\nghi\n    jkl\n        '
             'mno\n    pqi\nstu\n    vwx\n')
Ejemplo n.º 3
0
 def test_indenter_without_context_three_times(self, mock_stdout):
     indenter = Indenter()
     indenter.print('abc')
     indenter.print('def')
     indenter.print('ghi')
     assert mock_stdout.getvalue() == 'abc\ndef\nghi\n'