tests.test_code_indent   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 5

5 Functions

Rating   Name   Duplication   Size   Complexity  
A test_function_indent_multiline() 0 5 1
A test_line_indent_tabs() 0 5 1
A test_function_indent_single_line() 0 5 1
A test_line_indent_spaces() 0 6 1
A test_reindent() 0 5 1
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