Repository navigation
Test FSP parse errors, velocity edge cases and Segment.as_plane - #168
Open
claude[bot] wants to merge 1 commit into
Open
claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Tests-only change to
tests/test_fsp.pythat pins down the error handling and edge cases ofsource_modelling/fsp.py. Malformed inputs are built by copying a bundled FSP file intotmp_pathand editing one line.What the new tests check:
Segment.as_planevalidation. Each required attribute is removed in turn:strike,dip(set toNoneand to0),length,width,dtopandtop_centre. Each case must raiseValueErrorwith the exact message.Segment.as_planegeometry. For every Darfield segment, the plane's NZTM dip direction must be exactly 90° from its NZTM strike. The plane must keep the segment's dip, length and width, and the segment's top centre must map to fault coordinates(0.5, 0).FSPParseErrorwith the exact message:Nsbfssubfault countvelocity_model is Nonewhile the rest of the file still parses:Coverage of
source_modelling/fsp.pySurviving mutants
Killed. I checked each listed one by applying it locally and confirming the fsp tests then fail:
Segment.as_planemutants 2–6, where anandin the guard becomesor. The parametrised missing-attribute test kills them.Segment.as_planemutants 9–12, which change the error message. The exact-message match kills them.Segment.as_planemutant 24 (strike_nztm + 91). The perpendicular dip-direction check kills it.FSPFile.read_from_filemutants 38–41 (header error message)._parse_segment_slipmutants 14–16 (out-of-order segment message), 85–87 (missing-columns message, where the segment number is off by one or two) and 90 (missing-subfault-count message).Judged equivalent:
Segment.as_planemutants 49 and 56 (dip_dir_nztm=Noneor the argument dropped). When no dip direction is given,Plane.from_centroid_strike_dipdefaults it tostrike_nztm + 90, which is exactly the valueas_planepasses. I applied mutant 49 locally and it survives, as expected.FSPFile.read_from_filemutant 4 (open(fsp_ffp)without"r")."r"is the default mode.FSPFile.read_from_filemutant 30 (lstrip("XX% XX")).lstriptakes a set of characters, so the only change is that a leadingXwould also be stripped. No header line the pattern accepts starts withXafter%("EventTAG", "Loc", "Size", "Mech", "Rupt", "Invs", "SVF"), so parsing is unchanged.No issues filed: the tests found no incorrect behaviour.
🤖 Generated with Claude Code