Skip to content

Commit

Permalink
Add bracketmatch.py test (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 14, 2023
1 parent 73f2347 commit bb8f9ec
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
for ((x in {}) or {})['a'] in x:
pass
pem_spam = lambda l, spam = {
"x": 3
}: not spam.get(l.strip())
lambda x=lambda y={1: 3}: y['x':lambda y: {1: 2}]: x


# output


for ((x in {}) or {})["a"] in x:
pass
pem_spam = lambda l, spam={"x": 3}: not spam.get(l.strip())
lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,3 @@
"x": 3
}: not spam.get(l.strip())
lambda x=lambda y={1: 3}: y['x':lambda y: {1: 2}]: x


# output


for ((x in {}) or {})["a"] in x:
pass
pem_spam = lambda l, spam={"x": 3}: not spam.get(l.strip())
lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x
2 changes: 1 addition & 1 deletion crates/ruff_fmt/src/format/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ fn format_for(
[
text("for"),
space(),
target.format(),
group(&target.format()),
space(),
text("in"),
space(),
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_fmt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ mod tests {
}

#[test_case(Path::new("simple_cases/collections.py"); "collections")]
#[test_case(Path::new("simple_cases/bracketmatch.py"); "bracketmatch")]
fn passing_modulo_string_normalization(path: &Path) -> Result<()> {
fn adjust_quotes(contents: &str) -> String {
// Replace all single quotes with double quotes.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
source: src/source_code/mod.rs
assertion_line: 0
expression: formatted
---
for ((x in {}) or {})["a"] in x:
pass
pem_spam = lambda l, spam={"x": 3}: not spam.get(l.strip())
lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x

0 comments on commit bb8f9ec

Please sign in to comment.