right_to_left   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A left_join() 0 6 2
1
def left_join(phrases):
2
    # Join strings and replace "right" to "left"
3
    text = ','.join(phrases)
4
    while text.find('right') != -1:
5
        text = text.replace('right', 'left')
6
    return text
7
8
9
if __name__ == '__main__':  # pragma: no cover
10
    # These "asserts" using only for self-checking and not necessary for
11
    # auto-testing
12
    assert (
13
        left_join(("left", "right", "left", "stop")) == "left,left,left,stop"
14
    ), "All to left"
15
    assert left_join(("bright aright", "ok")) == "bleft aleft,ok", "Bright Left"
16
    assert left_join(("brightness wright",)) == "bleftness wleft", "One phrase"
17
    assert left_join(("enough", "jokes")) == "enough,jokes", "Nothing to replace"
18