Example #1
0
 def test_format_input_multi(self):
     code = dedent('''\
         def f(x):
             return x''')
     expected = dedent('''\
         >>> def f(x):
         >>>     return x''')
     result = R.format_input_prompt('>>> ', code, None)
     assert result == expected
Example #2
0
    def test_format_input_multi(self):
        code = dedent('''\
        def f(x):
            return x + 2

        f(2)
        ''').strip()
        expected = dedent('''\
        In [10]: def f(x):
            ...:     return x + 2
            ...:
            ...: f(2)
        ''').strip()
        result = R.format_input_prompt(code, 10)
        assert result == expected
Example #3
0
 def test_format_input(self):
     code = '2 + 2'
     expected = '>>> 2 + 2'
     result = R.format_input_prompt('>>> ', code, None)
     assert result == expected
Example #4
0
 def test_format_input_none(self):
     code = 'abcde'
     result = R.format_input_prompt(code, None)
     assert result == code
Example #5
0
 def test_format_input(self):
     code = '2 + 2'
     expected = 'In [1]: 2 + 2'
     result = R.format_input_prompt(code, 1)
     assert result == expected