Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit d227fa4

Browse files
committed
Add formatter demo test
1 parent ec760b9 commit d227fa4

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from typing import Optional
2+
3+
from rewrite.java import Space, P
4+
from rewrite.python import PythonVisitor
5+
from rewrite.test import rewrite_run, python, from_visitor
6+
7+
8+
def test_remove_all_spaces_demo():
9+
rewrite_run(
10+
python(
11+
# language=python
12+
"""
13+
class Foo:
14+
def getter(self, row):
15+
pass
16+
""", """classFoo:defgetter(self,row):pass"""
17+
),
18+
recipe=from_visitor(NoSpaces())
19+
)
20+
21+
class NoSpaces(PythonVisitor):
22+
def visit_space(self, space: Optional[Space], loc: Optional[Space.Location], p: P) -> Optional[Space]:
23+
return Space.EMPTY if space else None

0 commit comments

Comments
 (0)