tests.utilities   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A strip() 0 10 3
1
"""Test helpers."""
2
3
4
def strip(text, tabs=None, end='\n'):
5
    """Strip leading whitespace indentation on multiline string literals."""
6
    lines = []
7
8
    for line in text.strip().splitlines():
9
        if not tabs:
10
            tabs = line.count(' ' * 4)
11
        lines.append(line.replace(' ' * tabs * 4, '', 1))
12
13
    return '\n'.join(lines) + end
14