From d955d652f04bfc877c47a6197d32bc3e7b38ce63 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:30:23 +0000 Subject: [PATCH] py: bin-op-is --- .../bin-op-is/90fb6ffd47bb.mutation.json | 36 +++++++++++++++++++ corpus/python/bin-op-is/90fb6ffd47bb.py | 2 ++ crates/bough-core/src/language/javascript.rs | 3 ++ crates/bough-core/src/language/python.rs | 2 ++ crates/bough-core/src/language/typescript.rs | 3 ++ crates/bough-core/src/mutant.rs | 3 ++ 6 files changed, 49 insertions(+) create mode 100644 corpus/python/bin-op-is/90fb6ffd47bb.mutation.json create mode 100644 corpus/python/bin-op-is/90fb6ffd47bb.py diff --git a/corpus/python/bin-op-is/90fb6ffd47bb.mutation.json b/corpus/python/bin-op-is/90fb6ffd47bb.mutation.json new file mode 100644 index 00000000..dd0ff80a --- /dev/null +++ b/corpus/python/bin-op-is/90fb6ffd47bb.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "BinaryOp": "Is" + }, + "subst_span": { + "start": { + "line": 1, + "col": 6, + "byte": 15 + }, + "end": { + "line": 1, + "col": 8, + "byte": 17 + } + }, + "effect_span": { + "start": { + "line": 1, + "col": 4, + "byte": 13 + }, + "end": { + "line": 1, + "col": 13, + "byte": 22 + } + } + }, + "subst": "is not" +} \ No newline at end of file diff --git a/corpus/python/bin-op-is/90fb6ffd47bb.py b/corpus/python/bin-op-is/90fb6ffd47bb.py new file mode 100644 index 00000000..3c56cc86 --- /dev/null +++ b/corpus/python/bin-op-is/90fb6ffd47bb.py @@ -0,0 +1,2 @@ +a = None +x = a is not None diff --git a/crates/bough-core/src/language/javascript.rs b/crates/bough-core/src/language/javascript.rs index 3db4195d..13a97771 100644 --- a/crates/bough-core/src/language/javascript.rs +++ b/crates/bough-core/src/language/javascript.rs @@ -197,6 +197,9 @@ impl LanguageDriver for JavascriptDriver { MutantKind::BinaryOp(BinaryOpMutationKind::Xor) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::Exp) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::FloorDiv) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::In) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::Is) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::IsNot) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::Eq) => vec!["!=".into()], MutantKind::BinaryOp(BinaryOpMutationKind::StrictEq) => vec!["!==".into()], MutantKind::BinaryOp(BinaryOpMutationKind::Ne) => vec!["==".into()], diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index 138ef3d2..3886948a 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -45,6 +45,7 @@ impl LanguageDriver for PythonDriver { ">=" => BinaryOpMutationKind::Gte, "<" => BinaryOpMutationKind::Lt, "<=" => BinaryOpMutationKind::Lte, + "is" => BinaryOpMutationKind::Is, _ => return None, }; Some((MutantKind::BinaryOp(kind), span_from_node(&op_node), span_from_node(node))) @@ -89,6 +90,7 @@ impl LanguageDriver for PythonDriver { MutantKind::BinaryOp(BinaryOpMutationKind::Lte) => vec![">".into(), "<".into()], MutantKind::BinaryOp(BinaryOpMutationKind::Exp) => vec!["*".into(), "//".into()], MutantKind::BinaryOp(BinaryOpMutationKind::FloorDiv) => vec!["/".into(), "*".into()], + MutantKind::BinaryOp(BinaryOpMutationKind::Is) => vec!["is not".into()], _ => vec![], } } diff --git a/crates/bough-core/src/language/typescript.rs b/crates/bough-core/src/language/typescript.rs index 5957c302..4cef2f33 100644 --- a/crates/bough-core/src/language/typescript.rs +++ b/crates/bough-core/src/language/typescript.rs @@ -189,6 +189,9 @@ impl LanguageDriver for TypescriptDriver { MutantKind::BinaryOp(BinaryOpMutationKind::Xor) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::Exp) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::FloorDiv) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::In) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::Is) => vec![], + MutantKind::BinaryOp(BinaryOpMutationKind::IsNot) => vec![], MutantKind::BinaryOp(BinaryOpMutationKind::Eq) => vec!["!=".into()], MutantKind::BinaryOp(BinaryOpMutationKind::StrictEq) => vec!["!==".into()], MutantKind::BinaryOp(BinaryOpMutationKind::Ne) => vec!["==".into()], diff --git a/crates/bough-core/src/mutant.rs b/crates/bough-core/src/mutant.rs index e5b4d5e8..33a2b258 100644 --- a/crates/bough-core/src/mutant.rs +++ b/crates/bough-core/src/mutant.rs @@ -319,6 +319,9 @@ pub enum BinaryOpMutationKind { Exp, FloorDiv, Gt, + In, + Is, + IsNot, Gte, Lt, Lte, -- knotmirror 0.0.1