| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from menderbot.code import function_indent, line_indent, reindent |
||
| 2 | |||
| 3 | |||
| 4 | def test_line_indent_spaces(): |
||
| 5 | source = """ def foo(): |
||
| 6 | pass""" |
||
| 7 | expected = " " |
||
| 8 | |||
| 9 | assert line_indent(source) == expected |
||
| 10 | |||
| 11 | |||
| 12 | def test_line_indent_tabs(): |
||
| 13 | source = """\tdef foo():\n\t\tpass""" |
||
| 14 | expected = "\t" |
||
| 15 | |||
| 16 | assert line_indent(source) == expected |
||
| 17 | |||
| 18 | |||
| 19 | def test_function_indent_single_line(): |
||
| 20 | source = """ def foo():\n pass""" |
||
| 21 | expected = " " |
||
| 22 | |||
| 23 | assert function_indent(source) == expected |
||
| 24 | |||
| 25 | |||
| 26 | def test_function_indent_multiline(): |
||
| 27 | source = """ def foo():\n a=1\n return a""" |
||
| 28 | expected = " " |
||
| 29 | |||
| 30 | assert function_indent(source) == expected |
||
| 31 | |||
| 32 | |||
| 33 | def test_reindent(): |
||
| 34 | source = """ a\n b\n c""" |
||
| 35 | expected = """ a\n b\n c""" |
||
| 36 | |||
| 37 | assert reindent(source, " ") == expected |
||
| 38 |