Skip to content

Expand BPX GitHub file tests to cover all fields with warnings for mapping gaps#2

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-input-output-parsing
Draft

Expand BPX GitHub file tests to cover all fields with warnings for mapping gaps#2
Copilot wants to merge 3 commits intomainfrom
copilot/fix-input-output-parsing

Conversation

Copy link

Copilot AI commented Feb 27, 2026

test_bpx_github_files.py only spot-checked ~7 fields per conversion, leaving the majority of each parameter set untested and giving no signal about fields silently dropped due to missing ontology mappings.

Changes

Three new test helpers

  • _get_nested_value(data, path) — traverse a nested dict by tuple path, returning None on any missing key
  • _check_all_mapped_fields(bpx_raw, converted, mappings, output_type) — iterates every field in bpx_raw["Parameterisation"]; hard-asserts mapped fields are present with correct values (numeric: 1 ppm tolerance; string/function: non-empty expression); emits UserWarning for each unmapped field
  • _check_round_trip(converted, reference, mapped_output_paths) — compares converted output against a reference along every mapped path; emits UserWarning on key or value mismatch

Updated test classes

Spot-check methods in TestNMCBPXToBattMo, TestLFPBPXToBattMo, TestChen2020BPXToBattMo, and TestChen2020BattMoToBPX replaced with comprehensive tests:

def test_all_fields(self):
    """Check every BPX field; warn about unmapped ones, assert mapped ones."""
    _check_all_mapped_fields(
        self.bpx_raw, self.result, self.mappings, "battmo.m"
    )

Warning behaviour

Running with -W default::UserWarning now surfaces 33 actionable warnings:

  • 32 BPX field ... has no mapping to 'battmo.m' — the 16 known-unmapped fields per BPX file (thermal params, transport efficiency, entropic coefficients; see WORKAROUNDS.md)
  • 1 OCP string whitespace difference in the BattMo→BPX round-trip (minor normalisation difference between the two source files)

Tests hard-fail only on genuine mapping regressions; gaps in the ontology are visible but non-blocking.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: augustjohansson <9196210+augustjohansson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix input argument parsing and enhance converter tests Fix CLI argument parsing; add BPX GitHub example files, Chen 2020 round-trip tests, and validation data extraction utility Feb 27, 2026
…tched

Co-authored-by: augustjohansson <9196210+augustjohansson@users.noreply.github.com>
Copilot AI changed the title Fix CLI argument parsing; add BPX GitHub example files, Chen 2020 round-trip tests, and validation data extraction utility Expand BPX GitHub file tests to cover all fields with warnings for mapping gaps Feb 28, 2026
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.

2 participants