From 18cece54f347d8a0ee5d74460be5cb69fd0df7e8 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:55:57 +0000 Subject: [PATCH] py: dict-comprehension --- .../37aa4e7c1247.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/37aa4e7c1247.py | 1 + .../72e22c5d744c.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/72e22c5d744c.py | 1 + .../7ed55cd1ed88.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/7ed55cd1ed88.py | 1 + .../85d30cf38b91.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/85d30cf38b91.py | 1 + .../a01cfd513103.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/a01cfd513103.py | 1 + .../a805f4c2506d.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/a805f4c2506d.py | 1 + .../acb0b9d7d143.mutation.json | 36 +++++++++++++++++++ .../python/dict-comprehension/acb0b9d7d143.py | 1 + .../ca3d163bab05.mutation.json | 34 ++++++++++++++++++ .../python/dict-comprehension/ca3d163bab05.py | 1 + .../d7eb3cc43ee2.mutation.json | 34 ++++++++++++++++++ .../python/dict-comprehension/d7eb3cc43ee2.py | 1 + crates/bough-core/src/language/python.rs | 4 +-- 19 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 corpus/python/dict-comprehension/37aa4e7c1247.mutation.json create mode 100644 corpus/python/dict-comprehension/37aa4e7c1247.py create mode 100644 corpus/python/dict-comprehension/72e22c5d744c.mutation.json create mode 100644 corpus/python/dict-comprehension/72e22c5d744c.py create mode 100644 corpus/python/dict-comprehension/7ed55cd1ed88.mutation.json create mode 100644 corpus/python/dict-comprehension/7ed55cd1ed88.py create mode 100644 corpus/python/dict-comprehension/85d30cf38b91.mutation.json create mode 100644 corpus/python/dict-comprehension/85d30cf38b91.py create mode 100644 corpus/python/dict-comprehension/a01cfd513103.mutation.json create mode 100644 corpus/python/dict-comprehension/a01cfd513103.py create mode 100644 corpus/python/dict-comprehension/a805f4c2506d.mutation.json create mode 100644 corpus/python/dict-comprehension/a805f4c2506d.py create mode 100644 corpus/python/dict-comprehension/acb0b9d7d143.mutation.json create mode 100644 corpus/python/dict-comprehension/acb0b9d7d143.py create mode 100644 corpus/python/dict-comprehension/ca3d163bab05.mutation.json create mode 100644 corpus/python/dict-comprehension/ca3d163bab05.py create mode 100644 corpus/python/dict-comprehension/d7eb3cc43ee2.mutation.json create mode 100644 corpus/python/dict-comprehension/d7eb3cc43ee2.py diff --git a/corpus/python/dict-comprehension/37aa4e7c1247.mutation.json b/corpus/python/dict-comprehension/37aa4e7c1247.mutation.json new file mode 100644 index 00000000..ec7d4a0f --- /dev/null +++ b/corpus/python/dict-comprehension/37aa4e7c1247.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "float('-inf')" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/37aa4e7c1247.py b/corpus/python/dict-comprehension/37aa4e7c1247.py new file mode 100644 index 00000000..50c847bd --- /dev/null +++ b/corpus/python/dict-comprehension/37aa4e7c1247.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": float('-inf')}.items()} diff --git a/corpus/python/dict-comprehension/72e22c5d744c.mutation.json b/corpus/python/dict-comprehension/72e22c5d744c.mutation.json new file mode 100644 index 00000000..2d0f84cc --- /dev/null +++ b/corpus/python/dict-comprehension/72e22c5d744c.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "float('nan')" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/72e22c5d744c.py b/corpus/python/dict-comprehension/72e22c5d744c.py new file mode 100644 index 00000000..ab992a93 --- /dev/null +++ b/corpus/python/dict-comprehension/72e22c5d744c.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": float('nan')}.items()} diff --git a/corpus/python/dict-comprehension/7ed55cd1ed88.mutation.json b/corpus/python/dict-comprehension/7ed55cd1ed88.mutation.json new file mode 100644 index 00000000..af4bbbfb --- /dev/null +++ b/corpus/python/dict-comprehension/7ed55cd1ed88.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "float('inf')" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/7ed55cd1ed88.py b/corpus/python/dict-comprehension/7ed55cd1ed88.py new file mode 100644 index 00000000..002278c7 --- /dev/null +++ b/corpus/python/dict-comprehension/7ed55cd1ed88.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": float('inf')}.items()} diff --git a/corpus/python/dict-comprehension/85d30cf38b91.mutation.json b/corpus/python/dict-comprehension/85d30cf38b91.mutation.json new file mode 100644 index 00000000..5239a380 --- /dev/null +++ b/corpus/python/dict-comprehension/85d30cf38b91.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/85d30cf38b91.py b/corpus/python/dict-comprehension/85d30cf38b91.py new file mode 100644 index 00000000..cdeb8f39 --- /dev/null +++ b/corpus/python/dict-comprehension/85d30cf38b91.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": -1}.items()} diff --git a/corpus/python/dict-comprehension/a01cfd513103.mutation.json b/corpus/python/dict-comprehension/a01cfd513103.mutation.json new file mode 100644 index 00000000..47bc9f75 --- /dev/null +++ b/corpus/python/dict-comprehension/a01cfd513103.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/a01cfd513103.py b/corpus/python/dict-comprehension/a01cfd513103.py new file mode 100644 index 00000000..32ed61a1 --- /dev/null +++ b/corpus/python/dict-comprehension/a01cfd513103.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": 1}.items()} diff --git a/corpus/python/dict-comprehension/a805f4c2506d.mutation.json b/corpus/python/dict-comprehension/a805f4c2506d.mutation.json new file mode 100644 index 00000000..fd2c55c5 --- /dev/null +++ b/corpus/python/dict-comprehension/a805f4c2506d.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 24, + "byte": 24 + }, + "end": { + "line": 0, + "col": 25, + "byte": 25 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/a805f4c2506d.py b/corpus/python/dict-comprehension/a805f4c2506d.py new file mode 100644 index 00000000..685d2227 --- /dev/null +++ b/corpus/python/dict-comprehension/a805f4c2506d.py @@ -0,0 +1 @@ +{k: v for k, v in {"a": 0}.items()} diff --git a/corpus/python/dict-comprehension/acb0b9d7d143.mutation.json b/corpus/python/dict-comprehension/acb0b9d7d143.mutation.json new file mode 100644 index 00000000..f012e474 --- /dev/null +++ b/corpus/python/dict-comprehension/acb0b9d7d143.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "String" + }, + "subst_span": { + "start": { + "line": 0, + "col": 19, + "byte": 19 + }, + "end": { + "line": 0, + "col": 22, + "byte": 22 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 19, + "byte": 19 + }, + "end": { + "line": 0, + "col": 22, + "byte": 22 + } + } + }, + "subst": "\"\"" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/acb0b9d7d143.py b/corpus/python/dict-comprehension/acb0b9d7d143.py new file mode 100644 index 00000000..4ae48b39 --- /dev/null +++ b/corpus/python/dict-comprehension/acb0b9d7d143.py @@ -0,0 +1 @@ +{k: v for k, v in {"": 1}.items()} diff --git a/corpus/python/dict-comprehension/ca3d163bab05.mutation.json b/corpus/python/dict-comprehension/ca3d163bab05.mutation.json new file mode 100644 index 00000000..8bb39c65 --- /dev/null +++ b/corpus/python/dict-comprehension/ca3d163bab05.mutation.json @@ -0,0 +1,34 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": "DictDecl", + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 35, + "byte": 35 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 35, + "byte": 35 + } + } + }, + "subst": "{}" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/ca3d163bab05.py b/corpus/python/dict-comprehension/ca3d163bab05.py new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/corpus/python/dict-comprehension/ca3d163bab05.py @@ -0,0 +1 @@ +{} diff --git a/corpus/python/dict-comprehension/d7eb3cc43ee2.mutation.json b/corpus/python/dict-comprehension/d7eb3cc43ee2.mutation.json new file mode 100644 index 00000000..9c51026c --- /dev/null +++ b/corpus/python/dict-comprehension/d7eb3cc43ee2.mutation.json @@ -0,0 +1,34 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": "DictDecl", + "subst_span": { + "start": { + "line": 0, + "col": 18, + "byte": 18 + }, + "end": { + "line": 0, + "col": 26, + "byte": 26 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 18, + "byte": 18 + }, + "end": { + "line": 0, + "col": 26, + "byte": 26 + } + } + }, + "subst": "{}" +} \ No newline at end of file diff --git a/corpus/python/dict-comprehension/d7eb3cc43ee2.py b/corpus/python/dict-comprehension/d7eb3cc43ee2.py new file mode 100644 index 00000000..b2c5fcf3 --- /dev/null +++ b/corpus/python/dict-comprehension/d7eb3cc43ee2.py @@ -0,0 +1 @@ +{k: v for k, v in {}.items()} diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index 2de437d3..6dd680cc 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -95,7 +95,7 @@ impl LanguageDriver for PythonDriver { let span = span_from_node(node); Some((MutantKind::TupleDecl, span.clone(), span)) } - "set_comprehension" | "dictionary" if node.named_child_count() > 0 => { + "set_comprehension" | "dictionary_comprehension" | "dictionary" if node.named_child_count() > 0 => { let span = span_from_node(node); Some((MutantKind::DictDecl, span.clone(), span)) } @@ -251,6 +251,6 @@ mod tests { #[test] #[ignore] fn debug_tree() { - dump_tree("{x for x in [1, 2, 3]}"); + dump_tree("{k: v for k, v in {\"a\": 1}.items()}"); } } -- knotmirror 0.0.1