From 4b548f9dc1bc7424c3190da079bd890955262682 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:45:41 +0000 Subject: [PATCH] py: dict-decl --- .../dict-decl/d1d6c3ef69d9.mutation.json | 34 +++++++++++++++++++ corpus/python/dict-decl/d1d6c3ef69d9.py | 1 + crates/bough-core/src/language/python.rs | 5 +++ 3 files changed, 40 insertions(+) create mode 100644 corpus/python/dict-decl/d1d6c3ef69d9.mutation.json create mode 100644 corpus/python/dict-decl/d1d6c3ef69d9.py diff --git a/corpus/python/dict-decl/d1d6c3ef69d9.mutation.json b/corpus/python/dict-decl/d1d6c3ef69d9.mutation.json new file mode 100644 index 00000000..0312ab18 --- /dev/null +++ b/corpus/python/dict-decl/d1d6c3ef69d9.mutation.json @@ -0,0 +1,34 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": "DictDecl", + "subst_span": { + "start": { + "line": 0, + "col": 4, + "byte": 4 + }, + "end": { + "line": 0, + "col": 27, + "byte": 27 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 4, + "byte": 4 + }, + "end": { + "line": 0, + "col": 27, + "byte": 27 + } + } + }, + "subst": "{}" +} \ No newline at end of file diff --git a/corpus/python/dict-decl/d1d6c3ef69d9.py b/corpus/python/dict-decl/d1d6c3ef69d9.py new file mode 100644 index 00000000..26daf8bd --- /dev/null +++ b/corpus/python/dict-decl/d1d6c3ef69d9.py @@ -0,0 +1 @@ +x = {} diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index e5090444..8801aba0 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -91,6 +91,10 @@ impl LanguageDriver for PythonDriver { let condition = node.child_by_field_name("condition")?; Some((MutantKind::Condition, span_from_node(&condition), span_from_node(node))) } + "dictionary" if node.named_child_count() > 0 => { + let span = span_from_node(node); + Some((MutantKind::DictDecl, span.clone(), span)) + } "list" if node.named_child_count() > 0 => { let span = span_from_node(node); Some((MutantKind::ArrayDecl(crate::mutant::ArrayDeclKind::Inline), span.clone(), span)) @@ -154,6 +158,7 @@ impl LanguageDriver for PythonDriver { MutantKind::Assign(AssignMutationKind::FloorDivAssign) => vec!["/=".into(), "=".into()], MutantKind::StatementBlock => vec!["pass".into()], MutantKind::ArrayDecl(crate::mutant::ArrayDeclKind::Inline) => vec!["[]".into()], + MutantKind::DictDecl => vec!["{}".into()], MutantKind::Condition => vec!["True".into(), "False".into()], _ => vec![], } -- knotmirror 0.0.1