From 34a6a9bdee44aa8bc85aa683e54f61f7fd3be6b8 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:24:31 +0000 Subject: [PATCH] py: bin-op-or --- .../bin-op-or/79a484a28799.mutation.json | 36 +++++++++++++++++++ corpus/python/bin-op-or/79a484a28799.py | 3 ++ crates/bough-core/src/language/python.rs | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 corpus/python/bin-op-or/79a484a28799.mutation.json create mode 100644 corpus/python/bin-op-or/79a484a28799.py diff --git a/corpus/python/bin-op-or/79a484a28799.mutation.json b/corpus/python/bin-op-or/79a484a28799.mutation.json new file mode 100644 index 00000000..ff8a31dd --- /dev/null +++ b/corpus/python/bin-op-or/79a484a28799.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "BinaryOp": "Or" + }, + "subst_span": { + "start": { + "line": 2, + "col": 6, + "byte": 25 + }, + "end": { + "line": 2, + "col": 8, + "byte": 27 + } + }, + "effect_span": { + "start": { + "line": 2, + "col": 4, + "byte": 23 + }, + "end": { + "line": 2, + "col": 10, + "byte": 29 + } + } + }, + "subst": "and" +} \ No newline at end of file diff --git a/corpus/python/bin-op-or/79a484a28799.py b/corpus/python/bin-op-or/79a484a28799.py new file mode 100644 index 00000000..1bf6730c --- /dev/null +++ b/corpus/python/bin-op-or/79a484a28799.py @@ -0,0 +1,3 @@ +a = True +b = False +x = a and b diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index eeda15e9..31f9f02e 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -38,6 +38,7 @@ impl LanguageDriver for PythonDriver { let op_text = op_node.utf8_text(file_content).ok()?; let kind = match op_text { "and" => BinaryOpMutationKind::And, + "or" => BinaryOpMutationKind::Or, _ => return None, }; Some((MutantKind::BinaryOp(kind), span_from_node(&op_node), span_from_node(node))) @@ -63,6 +64,7 @@ impl LanguageDriver for PythonDriver { MutantKind::BinaryOp(BinaryOpMutationKind::Shl) => vec![">>".into()], MutantKind::BinaryOp(BinaryOpMutationKind::Shr) => vec!["<<".into()], MutantKind::BinaryOp(BinaryOpMutationKind::And) => vec!["or".into()], + MutantKind::BinaryOp(BinaryOpMutationKind::Or) => vec!["and".into()], _ => vec![], } } -- knotmirror 0.0.1