Skip to content

test: hermetic unit-test layer, batches 21-30 - #1084

Open
ilayfalach wants to merge 59 commits into
tests/batch20-gis-buildingsfrom
tests/batch30-coverage60
Open

ilayfalach wants to merge 59 commits into
tests/batch20-gis-buildingsfrom
tests/batch30-coverage60

Conversation

@ilayfalach

Copy link
Copy Markdown
Collaborator

Fourth in the stack: #1067 is 1-10, #1083 is 11-20, this is 21-30, and one more follows for 31-33.

Base is tests/batch20-gis-buildings, so this diff is batches 21-30 alone (59 commits). Merge #1083 first.

These are the batches that take the unit layer from partial coverage to roughly 60%, and they are where most of the defect log after B200 comes from.

Production code is touched only where the suite could not otherwise run. Every defect is pinned by an xfail(strict=True) test rather than fixed here.

🤖 Generated with Claude Code

Ilay Falach and others added 30 commits August 30, 2026 11:06
…eded)

processorList, read_points_file, getMeshExtent, getTimeList.

Records B83: getTimeList's single-processor branch checks os.path.isdir(x)
on the bare name instead of os.path.join(case, x), so it always resolves
against the cwd instead of the case directory -- the method returns an
empty list for the common (non-parallel) case.

Local-only, not pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nsion

Records three NameError bugs in absractEulerianSolver_toolkitExtension
(B84-B86): flowType references an undefined SIMULATIONTYPE_COMPRESSIBLE;
blockMesh_setBoundFromFile checks an undefined eulerianWF instead of its
own eulerianWorkFlow parameter; blockMesh_setDomainHeight is an unadapted
copy-paste of the same method, referencing fileName/dx/dy that aren't its
parameters, with its real input (Z) never used.

Local-only, not pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…concentration

sourcesTypeList, the six makeSource_* geometry generators,
writeParticlePositionFile, and analysis.calcConcentrationPointWise. No new
defects -- all verified correct against their documented geometry/math.

Local-only, not pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
time, dict, csv_pandas, JSON_pandas, netcdf_xarray, geopandas, image.

Records B87: DataHandler_JSON_geopandas.saveData calls
resource.to_json(fileName, **kwargs), but geopandas.GeoDataFrame.to_json's
first positional parameter is `na` (not a path) and the method returns a
JSON string rather than writing a file -- every call raises immediately.
getData is independent and works correctly, verified against a
hand-written file.

Local-only, not pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ct.py)

Adds unit coverage for FilesDirectory/filesDirectory, updateProjectNameOnDoc,
the saveMeasurementData/saveCacheData/saveSimulationData family, the
get/delete *DocumentsAsDict trio across all three collections, getMetadata,
getAllDocuments, getDocumentByID, setCounter/getCounterAndAdd, and both
getProjectList entry points.

Finds B88: Project.getProjectList is decorated @staticmethod but declares
an unused leading `cls` parameter, so the intended call
Project.getProjectList() raises TypeError. Pinned via xfail(strict=True).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…dule)

Adds unit coverage for Parser_CampbellBinary/CampbellBinaryInterface and
Parser_OldStyleMetaDataParquet in the (currently unimported) experiment
parsers module.

Finds B89: Parser_CampbellBinary.getData carries the exact same off-by-two
columnsIndexes bug already pinned as B82 in the meteorology highfreqdata
CampbellBinary parser -- an independent copy of the same broken code.

Finds B90: _getLists builds stationsData with the default (wrong)
DataFrame.from_dict orientation, putting attribute names in the row index
instead of station names -- breaks parse() for any station with more than
one location attribute.

Both pinned via xfail(strict=True).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds unit coverage for ToolkitRepository (register/lookup/table, backed by
the session mongomock reroute) and the pure dict/JSON repository-export
helpers (documentContentHash, documentToRepositoryItem,
mergeDocumentsIntoRepository, deduplicateRepository).

Finds B91: mergeDocumentsIntoRepository records report['added']/
['overwritten'] with the pre-disambiguation item_name, before
_uniqueItemName renames the key actually written -- on a name collision
between distinct documents, the report points at the wrong document.
Pinned via xfail(strict=True).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds unit coverage for presenation/Plots wiring and the pure dict/colormap
builders (_getCountourDict, _getContourfDict, _getcmap). No bugs found;
the heavier SeasonalPlots/DailyPlots contour-plotting methods need
realistically-shaped wind data and are left uncovered.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…esTable

Adds unit coverage for LSMToolkit's constructor/property validation, the
internal analysis wiring, and loadData's file/DB paths (NOSAVE, FILEANDDB,
duplicate-registration rejection).

Finds B92: loadData reads the template JSON's own desc into a local
variable used only to extract the name -- it's never passed to
addDataSource, so registered datasource documents never carry the
template's actual content (e.g. params). getTemplatesTable unconditionally
pops 'params' from every document's desc, so it crashes for every
template ever registered via the default (FILEANDDB) loadData path.
Pinned via xfail(strict=True).

getSimulations/getSimulationsList/prepareSlurmLSMExecution left
uncovered -- need real SingleSimulation documents or a Slurm environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds unit coverage for interp/checkInterpulation (distance-weighted
station interpolation, both scalar and vector-valued).

Finds three bugs:
- B93: windprofile is defined inside the class body with no `self`
  parameter -- calling it on an instance (the normal way) shifts every
  argument and crashes; only works called directly on the class.
- B94: interpPandas writes results via a chained assignment that pandas'
  copy-on-write silently drops -- the interpulation column always stays
  None, no exception raised.
- B95: interpArray passes topography=... to interpPandas, which has no
  such parameter -- every call raises TypeError immediately.

All three pinned via xfail(strict=True). canopyWindProfile.py's single
function left uncovered (needs full geopandas geometry + 3D grid setup).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n constructor

Adds unit coverage for the property setters/getters, particle mass
derivation, all four drag-coefficient formulas, and the hit_ground ODE
event -- all verified via __new__ since the real constructor cannot run.

Finds B96: __init__ calls MeteorologyFactory().getMeteorology(...), a
method that does not exist (only getMeteorologyFromU10/
getMeteorologyFromURefHeight are defined, with different parameters).
Every construction of FallingNonEvaporatingDroplets raises AttributeError
-- the class is entirely unusable through its public API. Pinned via
xfail(strict=True).

getTerminalVelocity/_VTFunc/correctionCloud_Plume/_Puff/solveToTime/
_fallingParticle left uncovered -- all need self.meteorology, unreachable
while B96 stands.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds unit coverage for _parse_query_value (query-string type coercion) and
load_project_name (reading projectName from caseConfiguration.json). No
bugs found. The ~26 argparse command handlers all touch a real
Project/toolkit via the module's lazy _setup() and are left uncovered.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… tests

Discovered while validating against a venv pinned to requirements.txt with
the hermes.workflow stub fix installed:

- B84/B85/B86 (flowType/blockMesh_setBoundFromFile/blockMesh_setDomainHeight):
  were real, accurate findings at the time; commit 276d9a9 ("fix: repair
  OpenFOAM Eulerian solver name errors and method mismatches") fixed all
  three independently of this test-expansion effort.

Rewrote test_openfoam_eulerian_solver.py to check the real (working)
behavior: flowType for both incompressible values, and both the
non-eulerian-workflow rejection path and the real-workflow success path
for the two blockMesh_* setters (via a _FakeWorkflow subclass of the now
properly-stubbed workflow_Eulerian).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Discovered while validating against a venv pinned to requirements.txt:
B94 was verified against a locally-drifted pandas (3.0.2) where
copy-on-write is mandatory. Under the pinned pandas (2.2.3), copy-on-write
is opt-in -- the chained assignment in interpPandas still works, with
only a FutureWarning/SettingWithCopyWarning. Replaced the xfail
characterization with a single passing test; noted in both the module
docstring and the findings log that this would resurface if pandas is
upgraded past 2.x with copy-on-write made the default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…lass)

Adds unit coverage for guessHandler (module-level wrapper), DataHandler_tif
(real GeoTIFF via rasterio, which is installed under the pinned
requirements.txt unlike osgeo/tables/zarr), DataHandler_numpy_dict_array
(.npz round trip), and DataHandler_Class (dynamic class loading via both
the sys.path and resource-fallback code paths, the parameters/kwargs
merge rule, instantiate=False, and the two documented error cases).

No bugs found. Verified directly against the pinned venv, not the
drifted shared heraenv.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…kup)

Adds unit coverage for SingleSimulation's construction (Dataset directly,
and a document with getData()), params/version properties, getDosage
(both the datetime64 and numeric-datetime branches, Q scaling, unit
attrs), and getConcentration.

Finds B98: getConcentrationAtPoint, called exactly as documented with a
single scalar x/y/datetime, always raises IndexError -- .interp() on a
fully-specified point returns a 0-dimensional DataArray, and .values[0]
on a 0-d array is invalid. Pinned via xfail(strict=True).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…okups)

Adds unit coverage for LSMTemplate's properties (Toolkit, doctype_simulation,
dirPath, params, version, templateName, modelFolder), prepareParams (unit
conversion, duration-as-minutes, TopoXn/TopoYn int casting), and
getSimulationByName/getSimulations query dispatch (via a monkeypatched
SingleSimulation, since a real one needs actual netcdf files on disk).

The document is built by hand rather than through LSMToolkit.loadData(),
to isolate this file's own logic from the already-documented B92
(loadData never persists the template JSON's own desc).

Finds B99: getSimulationByID calls self.getDocumentByID(id), a
Project/toolkit method LSMTemplate does not have on itself -- every call
raises AttributeError. Pinned via xfail(strict=True).

run()/_toNetcdf()/_getSimulationsList/getSimulationsTable left uncovered
-- need a real LSM binary or heavier table-building setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…MaxConcentration

No bugs found. presentation/classLoggerName/getToolkitDocument on
abstractToolkit; Agent.tenbergeCoefficient getter/setter; and
CalculatorMaxConcentration.calculate (pandas path) + toJSON.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…che)

No bugs found. Serialization helpers, _get_full_func_name, and
cacheFunction end-to-end (caching, cache-clear, returnDoc, postProcessFunction).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Finds B100: FixedPointClippedDropletCloud.__init__ reads self.clippedDiameter
before setting it (via super().__init__() polymorphic dispatch), crashing
before it can even reach the already-documented B96.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 20, 2026
@lior-antonov
lior-antonov added this pull request to stack #1117 September 23, 2026 10:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant