Skip to content

Commit ad54004

Browse files
committed
invert test node range feature condition
1 parent 83a4320 commit ad54004

File tree

35 files changed

+608
-431
lines changed

35 files changed

+608
-431
lines changed

parser/src/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ mod tests {
6666
}
6767

6868
#[test]
69-
#[cfg(not(feature = "all-nodes-with-ranges"))]
69+
#[cfg(feature = "all-nodes-with-ranges")]
7070
fn test_assign_list() {
7171
let source = "[x, y] = (1, 2, 3)";
7272
let parse_ast = parse_program(source, "<test>").unwrap();
@@ -102,23 +102,23 @@ mod tests {
102102
}
103103

104104
#[test]
105-
#[cfg(not(feature = "all-nodes-with-ranges"))]
105+
#[cfg(feature = "all-nodes-with-ranges")]
106106
fn test_assign_list_comp() {
107107
let source = "x = [y for y in (1, 2, 3)]";
108108
let parse_ast = parse_program(source, "<test>").unwrap();
109109
insta::assert_debug_snapshot!(parse_ast);
110110
}
111111

112112
#[test]
113-
#[cfg(not(feature = "all-nodes-with-ranges"))]
113+
#[cfg(feature = "all-nodes-with-ranges")]
114114
fn test_assign_set_comp() {
115115
let source = "x = {y for y in (1, 2, 3)}";
116116
let parse_ast = parse_program(source, "<test>").unwrap();
117117
insta::assert_debug_snapshot!(parse_ast);
118118
}
119119

120120
#[test]
121-
#[cfg(not(feature = "all-nodes-with-ranges"))]
121+
#[cfg(feature = "all-nodes-with-ranges")]
122122
fn test_assign_with() {
123123
let source = "with 1 as x: pass";
124124
let parse_ast = parse_program(source, "<test>").unwrap();

parser/src/function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ mod tests {
139139
use super::*;
140140
use crate::parser::{parse_program, ParseErrorType};
141141

142-
#[cfg(not(feature = "all-nodes-with-ranges"))]
142+
#[cfg(feature = "all-nodes-with-ranges")]
143143
macro_rules! function_and_lambda {
144144
($($name:ident: $code:expr,)*) => {
145145
$(
@@ -152,7 +152,7 @@ mod tests {
152152
}
153153
}
154154

155-
#[cfg(not(feature = "all-nodes-with-ranges"))]
155+
#[cfg(feature = "all-nodes-with-ranges")]
156156
function_and_lambda! {
157157
test_function_no_args: "def f(): pass",
158158
test_function_pos_args: "def f(a, b, c): pass",

parser/src/parser.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ mod tests {
379379
}
380380

381381
#[test]
382-
#[cfg(not(feature = "all-nodes-with-ranges"))]
382+
#[cfg(feature = "all-nodes-with-ranges")]
383383
fn test_parse_lambda() {
384384
let source = "lambda x, y: x * y"; // lambda(x, y): x * y";
385385
let parse_ast = parse_program(source, "<test>").unwrap();
@@ -394,7 +394,7 @@ mod tests {
394394
}
395395

396396
#[test]
397-
#[cfg(not(feature = "all-nodes-with-ranges"))]
397+
#[cfg(feature = "all-nodes-with-ranges")]
398398
fn test_parse_class() {
399399
let source = "\
400400
class Foo(A, B):
@@ -407,47 +407,47 @@ class Foo(A, B):
407407
}
408408

409409
#[test]
410-
#[cfg(not(feature = "all-nodes-with-ranges"))]
410+
#[cfg(feature = "all-nodes-with-ranges")]
411411
fn test_parse_dict_comprehension() {
412412
let source = "{x1: x2 for y in z}";
413413
let parse_ast = parse_expression(source, "<test>").unwrap();
414414
insta::assert_debug_snapshot!(parse_ast);
415415
}
416416

417417
#[test]
418-
#[cfg(not(feature = "all-nodes-with-ranges"))]
418+
#[cfg(feature = "all-nodes-with-ranges")]
419419
fn test_parse_list_comprehension() {
420420
let source = "[x for y in z]";
421421
let parse_ast = parse_expression(source, "<test>").unwrap();
422422
insta::assert_debug_snapshot!(parse_ast);
423423
}
424424

425425
#[test]
426-
#[cfg(not(feature = "all-nodes-with-ranges"))]
426+
#[cfg(feature = "all-nodes-with-ranges")]
427427
fn test_parse_double_list_comprehension() {
428428
let source = "[x for y, y2 in z for a in b if a < 5 if a > 10]";
429429
let parse_ast = parse_expression(source, "<test>").unwrap();
430430
insta::assert_debug_snapshot!(parse_ast);
431431
}
432432

433433
#[test]
434-
#[cfg(not(feature = "all-nodes-with-ranges"))]
434+
#[cfg(feature = "all-nodes-with-ranges")]
435435
fn test_parse_generator_comprehension() {
436436
let source = "(x for y in z)";
437437
let parse_ast = parse_expression(source, "<test>").unwrap();
438438
insta::assert_debug_snapshot!(parse_ast);
439439
}
440440

441441
#[test]
442-
#[cfg(not(feature = "all-nodes-with-ranges"))]
442+
#[cfg(feature = "all-nodes-with-ranges")]
443443
fn test_parse_named_expression_generator_comprehension() {
444444
let source = "(x := y + 1 for y in z)";
445445
let parse_ast = parse_expression(source, "<test>").unwrap();
446446
insta::assert_debug_snapshot!(parse_ast);
447447
}
448448

449449
#[test]
450-
#[cfg(not(feature = "all-nodes-with-ranges"))]
450+
#[cfg(feature = "all-nodes-with-ranges")]
451451
fn test_parse_if_else_generator_comprehension() {
452452
let source = "(x if y else y for y in z)";
453453
let parse_ast = parse_expression(source, "<test>").unwrap();
@@ -476,7 +476,7 @@ class Foo(A, B):
476476
}
477477

478478
#[test]
479-
#[cfg(not(feature = "all-nodes-with-ranges"))]
479+
#[cfg(feature = "all-nodes-with-ranges")]
480480
fn test_with_statement() {
481481
let source = "\
482482
with 0: pass
@@ -546,7 +546,7 @@ array[3:5, *indexes_to_select]
546546
}
547547

548548
#[test]
549-
#[cfg(not(feature = "all-nodes-with-ranges"))]
549+
#[cfg(feature = "all-nodes-with-ranges")]
550550
fn test_generator_expression_argument() {
551551
let source = r#"' '.join(
552552
sql
@@ -606,7 +606,7 @@ except* OSError as e:
606606
}
607607

608608
#[test]
609-
#[cfg(not(feature = "all-nodes-with-ranges"))]
609+
#[cfg(feature = "all-nodes-with-ranges")]
610610
fn test_match_as_identifier() {
611611
let parse_ast = parse_program(
612612
r#"
@@ -639,7 +639,7 @@ print(match(12))
639639
}
640640

641641
#[test]
642-
#[cfg(not(feature = "all-nodes-with-ranges"))]
642+
#[cfg(feature = "all-nodes-with-ranges")]
643643
fn test_patma() {
644644
let source = r#"# Cases sampled from Lib/test/test_patma.py
645645
@@ -811,7 +811,7 @@ match w := x,:
811811
}
812812

813813
#[test]
814-
#[cfg(not(feature = "all-nodes-with-ranges"))]
814+
#[cfg(feature = "all-nodes-with-ranges")]
815815
fn test_match() {
816816
let parse_ast = parse_program(
817817
r#"
@@ -842,7 +842,7 @@ match x:
842842
}
843843

844844
#[test]
845-
#[cfg(not(feature = "all-nodes-with-ranges"))]
845+
#[cfg(feature = "all-nodes-with-ranges")]
846846
fn test_variadic_generics() {
847847
let parse_ast = parse_program(
848848
r#"

parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args.snap

Lines changed: 25 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap

Lines changed: 25 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__function__tests__function_no_args.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)