aboutsummaryrefslogtreecommitdiff
path: root/tests/test_string.py
blob: 1101d26ad834d79d579f156813d936b22de1295e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from rainbow_parenthesis import colorize, Colored
import io


def test_escaped_parenthesis():
    assert list(r"\(") == list(colorize(io.StringIO(r"\(")))


def test_escaped_parenthesis_in_string():
    assert list(r"'\('") == list(colorize(io.StringIO(r"'\('")))


def test_escaped_quot_in_string():
    assert list(r"'\''") == list(colorize(io.StringIO(r"'\''")))


def test_embedded_string():
    assert list(colorize(io.StringIO("( '(' )"))) == [
        Colored(depth=0, item='('),
        *" '(' ",
        Colored(depth=0, item=')'),
    ]