From 58bb92d4f028f526e485e7599eeee0c0768aaddd Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Thu, 19 Mar 2026 09:48:17 +0000 Subject: [PATCH] py: literal-number --- .../literal-number/10e820d2a635.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/10e820d2a635.py | 1 + .../literal-number/339a210b636c.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/339a210b636c.py | 1 + .../literal-number/4355a46b19d3.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/4355a46b19d3.py | 1 + .../literal-number/76785333385b.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/76785333385b.py | 1 + .../literal-number/9a271f2a916b.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/9a271f2a916b.py | 1 + .../literal-number/ee3aa64bb94a.mutation.json | 36 +++++++++++++++++++ corpus/python/literal-number/ee3aa64bb94a.py | 1 + crates/bough-core/src/language/python.rs | 14 +++++++- 13 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 corpus/python/literal-number/10e820d2a635.mutation.json create mode 100644 corpus/python/literal-number/10e820d2a635.py create mode 100644 corpus/python/literal-number/339a210b636c.mutation.json create mode 100644 corpus/python/literal-number/339a210b636c.py create mode 100644 corpus/python/literal-number/4355a46b19d3.mutation.json create mode 100644 corpus/python/literal-number/4355a46b19d3.py create mode 100644 corpus/python/literal-number/76785333385b.mutation.json create mode 100644 corpus/python/literal-number/76785333385b.py create mode 100644 corpus/python/literal-number/9a271f2a916b.mutation.json create mode 100644 corpus/python/literal-number/9a271f2a916b.py create mode 100644 corpus/python/literal-number/ee3aa64bb94a.mutation.json create mode 100644 corpus/python/literal-number/ee3aa64bb94a.py diff --git a/corpus/python/literal-number/10e820d2a635.mutation.json b/corpus/python/literal-number/10e820d2a635.mutation.json new file mode 100644 index 00000000..3260a4a3 --- /dev/null +++ b/corpus/python/literal-number/10e820d2a635.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "float('-inf')" +} \ No newline at end of file diff --git a/corpus/python/literal-number/10e820d2a635.py b/corpus/python/literal-number/10e820d2a635.py new file mode 100644 index 00000000..5448029a --- /dev/null +++ b/corpus/python/literal-number/10e820d2a635.py @@ -0,0 +1 @@ +float('-inf') diff --git a/corpus/python/literal-number/339a210b636c.mutation.json b/corpus/python/literal-number/339a210b636c.mutation.json new file mode 100644 index 00000000..347bde1a --- /dev/null +++ b/corpus/python/literal-number/339a210b636c.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "float('inf')" +} \ No newline at end of file diff --git a/corpus/python/literal-number/339a210b636c.py b/corpus/python/literal-number/339a210b636c.py new file mode 100644 index 00000000..908211da --- /dev/null +++ b/corpus/python/literal-number/339a210b636c.py @@ -0,0 +1 @@ +float('inf') diff --git a/corpus/python/literal-number/4355a46b19d3.mutation.json b/corpus/python/literal-number/4355a46b19d3.mutation.json new file mode 100644 index 00000000..3cd91efd --- /dev/null +++ b/corpus/python/literal-number/4355a46b19d3.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/python/literal-number/4355a46b19d3.py b/corpus/python/literal-number/4355a46b19d3.py new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/corpus/python/literal-number/4355a46b19d3.py @@ -0,0 +1 @@ +1 diff --git a/corpus/python/literal-number/76785333385b.mutation.json b/corpus/python/literal-number/76785333385b.mutation.json new file mode 100644 index 00000000..5865983d --- /dev/null +++ b/corpus/python/literal-number/76785333385b.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "float('nan')" +} \ No newline at end of file diff --git a/corpus/python/literal-number/76785333385b.py b/corpus/python/literal-number/76785333385b.py new file mode 100644 index 00000000..dfbac68c --- /dev/null +++ b/corpus/python/literal-number/76785333385b.py @@ -0,0 +1 @@ +float('nan') diff --git a/corpus/python/literal-number/9a271f2a916b.mutation.json b/corpus/python/literal-number/9a271f2a916b.mutation.json new file mode 100644 index 00000000..9092dfcc --- /dev/null +++ b/corpus/python/literal-number/9a271f2a916b.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/python/literal-number/9a271f2a916b.py b/corpus/python/literal-number/9a271f2a916b.py new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/corpus/python/literal-number/9a271f2a916b.py @@ -0,0 +1 @@ +0 diff --git a/corpus/python/literal-number/ee3aa64bb94a.mutation.json b/corpus/python/literal-number/ee3aa64bb94a.mutation.json new file mode 100644 index 00000000..79c21995 --- /dev/null +++ b/corpus/python/literal-number/ee3aa64bb94a.mutation.json @@ -0,0 +1,36 @@ +{ + "mutant": { + "lang": "py", + "twig": [ + "src/a.py" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + }, + "effect_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/python/literal-number/ee3aa64bb94a.py b/corpus/python/literal-number/ee3aa64bb94a.py new file mode 100644 index 00000000..3a2e3f49 --- /dev/null +++ b/corpus/python/literal-number/ee3aa64bb94a.py @@ -0,0 +1 @@ +-1 diff --git a/crates/bough-core/src/language/python.rs b/crates/bough-core/src/language/python.rs index ce1a4ef8..91333cf9 100644 --- a/crates/bough-core/src/language/python.rs +++ b/crates/bough-core/src/language/python.rs @@ -113,6 +113,10 @@ impl LanguageDriver for PythonDriver { }; Some((MutantKind::BinaryOp(kind), span_from_node(&op_node), span_from_node(node))) } + "integer" | "float" => { + let span = span_from_node(node); + Some((MutantKind::Literal(crate::mutant::LiteralKind::Number), span.clone(), span)) + } "true" => { let span = span_from_node(node); Some((MutantKind::Literal(crate::mutant::LiteralKind::BoolTrue), span.clone(), span)) @@ -174,6 +178,14 @@ impl LanguageDriver for PythonDriver { MutantKind::DictDecl => vec!["{}".into()], MutantKind::Literal(crate::mutant::LiteralKind::BoolTrue) => vec!["False".into()], MutantKind::Literal(crate::mutant::LiteralKind::BoolFalse) => vec!["True".into()], + MutantKind::Literal(crate::mutant::LiteralKind::Number) => vec![ + "0".into(), + "1".into(), + "-1".into(), + "float('inf')".into(), + "float('-inf')".into(), + "float('nan')".into(), + ], MutantKind::Condition => vec!["True".into(), "False".into()], _ => vec![], } @@ -215,6 +227,6 @@ mod tests { #[test] #[ignore] fn debug_tree() { - dump_tree("(1, 2, 3)"); + dump_tree("123"); } } -- knotmirror 0.0.1