Repository navigation
test(notebook_tools): add 28 mutation-killing tests (See #2149) - #2333
Merged
Merged
Conversation
…tions (See #2149) Mutation testing analysis of notebook_tools.py (1656 lines) identified surviving mutants in core validation functions. Added targeted tests: - should_skip: wildcard patterns, false positives, all SKIP_PATTERNS - detect_kernel: csharp/fsharp language variants, case sensitivity, raw cells, magic detection boundary - extract_cell_preview: max_chars boundary, max_lines=1, word truncation - NotebookAnalyzer: invalid JSON, missing file, kernel/cells on None - NotebookValidator: ZeroDivisionError, AssertionError, invalid JSON, no-metadata warning, cell counting, missing title pedagogy - discover_notebooks: recursive discovery, non-ipynb filtering Test suite: 65 -> 93 tests (28 new, all passing) mutmut and cosmic-ray don't support Windows natively. Used manual mutation analysis targeting operator replacement, constant mutation, and condition boundary mutants in high-value functions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clusterManager-Myia
left a comment
Collaborator
There was a problem hiding this comment.
[NanoClaw] Review PR #2333
28 mutation-killing tests for notebook_tools. All assertions verified against the source — they match the actual implementation behavior correctly.
What's good:
- Solid edge case coverage across all 5 target functions: wildcard pattern matching, kernel detection boundary conditions (csharp without .net prefix, lean4 without lean in kernel name, case-insensitive Python, raw vs code cell for magic detection), cell preview truncation, error handling for missing/invalid files, and recursive notebook discovery.
test_magic_in_code_cell_onlycorrectly verifies that#!importin a raw cell doesn't trigger .NET detection — a real mutation survivor if thecell_type == 'code'check were removed.test_no_false_positives_similar_namesforshould_skipcatches theoutput_analyzer.ipynbcase that would survive a substring-to-contains mutation.- Pattern follows existing test structure (class-based, descriptive docstrings, reuses
_make_notebook/_write_notebookhelpers).
Minor observations (non-blocking):
test_exact_max_chars_no_truncationassertslen(preview) <= 153— this is technically correct but very loose. The actual behavior truncates at exactly 150, producing something shorter. A tighter bound (e.g.< 150or checking for...suffix) would catch more mutants.test_truncation_at_word_boundaryhasif len(preview) > 30guard that's always true for the input — not wrong, just dead code in the test.test_no_metadata_flaggeddouble-checks both"metadata" in messageandresult.has_metadata is False— the second branch is unreachable since the first always matches, but it's defensive rather than harmful.
No secrets, no behavioral mismatches. Tests are ready to merge.
This was referenced Jun 4, 2026
This was referenced Jun 4, 2026
jsboige
added a commit
that referenced
this pull request
Jun 5, 2026
…tions (See #2149) (#2333) Mutation testing analysis of notebook_tools.py (1656 lines) identified surviving mutants in core validation functions. Added targeted tests: - should_skip: wildcard patterns, false positives, all SKIP_PATTERNS - detect_kernel: csharp/fsharp language variants, case sensitivity, raw cells, magic detection boundary - extract_cell_preview: max_chars boundary, max_lines=1, word truncation - NotebookAnalyzer: invalid JSON, missing file, kernel/cells on None - NotebookValidator: ZeroDivisionError, AssertionError, invalid JSON, no-metadata warning, cell counting, missing title pedagogy - discover_notebooks: recursive discovery, non-ipynb filtering Test suite: 65 -> 93 tests (28 new, all passing) mutmut and cosmic-ray don't support Windows natively. Used manual mutation analysis targeting operator replacement, constant mutation, and condition boundary mutants in high-value functions. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mutation testing analysis of
notebook_tools.py(1656 lines, core validation module). Added 28 targeted tests to kill surviving mutants in critical functions.Mutation Testing Approach
mutmut and cosmic-ray don't support Windows natively. Used manual mutation analysis:
Tests Added (28 new)
should_skipdetect_kernelextract_cell_previewNotebookAnalyzerNotebookValidatordiscover_notebooksValidation
Metrics
See #2149