aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile6
-rw-r--r--rainbow_parenthesis/__init__.py1
-rw-r--r--tests/test_string.py6
3 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b665b00..2e0875a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
.PHONY: check check-style check-type \
- build wheel install clean sphinx-apidoc documentation
+ build wheel install clean sphinx-apidoc documentation \
+ test
PYTHON = python
DOC_OUTPUT = doc.rendered
@@ -31,6 +32,9 @@ $(DOC_OUTPUT)/index.html: sphinx-apidoc
documentation: sphinx-apidoc
+test:
+ python -m pytest
+
clean:
-rm -r build
-rm -r dist
diff --git a/rainbow_parenthesis/__init__.py b/rainbow_parenthesis/__init__.py
index 32b7493..1f5e2f7 100644
--- a/rainbow_parenthesis/__init__.py
+++ b/rainbow_parenthesis/__init__.py
@@ -112,6 +112,7 @@ def colorize(strm: io.TextIOBase) -> Generator[str | Colored, None, None]:
in_string = '"'
yield c
case '\\':
+ yield c
yield strm.read(1)
case c:
yield c
diff --git a/tests/test_string.py b/tests/test_string.py
new file mode 100644
index 0000000..5d3040b
--- /dev/null
+++ b/tests/test_string.py
@@ -0,0 +1,6 @@
+from rainbow_parenthesis import colorize, Colored
+import io
+
+
+def test_escaped_parenthesis():
+ assert list(r"\(") == list(colorize(io.StringIO(r"\(")))