From dddcdd0fbb1a14f61ddac48d3f404216f1065553 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:32:24 +0000 Subject: [PATCH] py: bin-op-not-in --- .../bin-op-not-in/2466e3d2822f.mutation.json | 36 +++++++++++++++++++ corpus/python/bin-op-not-in/2466e3d2822f.py | 2 ++ crates/bough-core/src/language/python.rs | 4 ++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 corpus/python/bin-op-not-in/2466e3d2822f.mutation.json create mode 100644 corpus/python/bin-op-not-in/2466e3d2822f.py diff --git a/corpus/python/bin-op-not-in/2466e3d2822f.mutation.json b/corpus/python/bin-op-not-in/2466e3d2822f.mutation.json new file mode 100644 index 00000000..d2639562 --- /dev/null +++ b/corpus/python/bin-op-not-in/2466e3d2822f.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "BinaryOp": "NotIn" + }, + "subst_span": { + "start": { + "line": 1, + "col": 6, + "byte": 20 + }, + "end": { + "line": 1, + "col": 12, + "byte": 26 + } + }, + "effect_span": { + "start": { + "line": 1, + "col": 4, + "byte": 18 + }, + "end": { + "line": 1, + "col": 14, + "byte": 28 + } + } + }, + "subst": "in" +} \ No newline at end of file diff --git a/corpus/python/bin-op-not-in/2466e3d2822f.py b/corpus/python/bin-op-not-in/2466e3d2822f.py new file mode 100644 index 00000000..61ad6710 --- /dev/null +++ b/corpus/python/bin-op-not-in/2466e3d2822f.py @@ -0,0 +1,2 @@ +a = [1, 2, 3] +x = 4 in a diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index 612ddf68..e5037a9f 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -48,6 +48,7 @@ impl LanguageDriver for PythonDriver { "is" => BinaryOpMutationKind::Is, "is not" => BinaryOpMutationKind::IsNot, "in" => BinaryOpMutationKind::In, + "not in" => BinaryOpMutationKind::NotIn, _ => return None, }; Some((MutantKind::BinaryOp(kind), span_from_node(&op_node), span_from_node(node))) @@ -95,6 +96,7 @@ impl LanguageDriver for PythonDriver { MutantKind::BinaryOp(BinaryOpMutationKind::Is) => vec!["is not".into()], MutantKind::BinaryOp(BinaryOpMutationKind::IsNot) => vec!["is".into()], MutantKind::BinaryOp(BinaryOpMutationKind::In) => vec!["not in".into()], + MutantKind::BinaryOp(BinaryOpMutationKind::NotIn) => vec!["in".into()], _ => vec![], } } @@ -132,6 +134,6 @@ mod tests { #[test] #[ignore] fn debug_tree() { - dump_tree("a = 1\nb = 2\nx = a == b\ny = a is not None\nz = 1 in [1,2]"); + dump_tree("a = [1, 2, 3]\nx = 4 not in a"); } } -- knotmirror 0.0.1