Skip to content

fix: model member-name and AwkwardForth-API bugs in TTree v18, TTime, TAtt#1655

Open
henryiii wants to merge 3 commits into
mainfrom
fix-models-misc
Open

fix: model member-name and AwkwardForth-API bugs in TTree v18, TTime, TAtt#1655
henryiii wants to merge 3 commits into
mainfrom
fix-models-misc

Conversation

@henryiii

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Part of #1646.

Summary

Five model-level bugs fixed:

  • TTree v18 (src/uproot/models/TTree.py): Model_TTree_v18 defined a property called member_values — a name that exists nowhere else and is never looked up. Every sibling version (v16, v17, v19, v20) defines member_names. The result was that member_names silently returned the base-class empty list [] for v18 trees. Renamed to member_names.

  • TTime (src/uproot/models/TTime.py): Model_TTime_v2.read_members used a long-removed ForthGenerator API (get_gen_obj(), get_keys(), add_to_header(), should_add_form(), add_form_key(), add_to_pre(), add_form(), old add_node(...) signature). None of these exist on the current ForthGenerator / Node API in _awkwardforth.py. Any Forth-path read of a TTime-containing branch would raise AttributeError. Ported to the current Node-based API, mirroring TDatime.py (same structure: one big-endian fixed-width integer field, no versioning header).

  • TAtt (src/uproot/models/TAtt.py): Typo "fMarkserSize" in Model_TAttMarker_v2.member_names — corrected to "fMarkerSize" (consistent with the field name used in read_members, strided_interpretation, awkward_form, and _serialize).

  • TTable (src/uproot/models/TTable.py): Removed dead module-level format = {...} dict that (a) was never used anywhere — only the adjacent _dtype dict is used — and (b) shadowed the Python builtin format. Also updated the module docstring, which incorrectly referred to TTree instead of TTable.

  • TMatrixT (src/uproot/models/TMatrixT.py): Module docstring referred to TLeaf and its subclasses; corrected to TMatrixT.

Test plan

  • uv run pytest tests/test_1647_model_fixes.py -v — 5 new regression tests, all pass
  • uv run pytest tests/test_0018_array_fetching_interface.py tests/test_0033_more_interpretations_2.py tests/test_0014_all_ttree_versions.py tests/test_0023_ttree_versions.py tests/test_0418_read_TTable.py tests/test_1610_read_TMatrixTSym_from_ttree.py tests/test_0011_generate_classes_from_streamers.py -q — all pass
  • prek -a --quiet — clean

Skipped / not applicable

  • TGraph.py and TH.py docstrings were explicitly excluded (generated files).
  • No ROOT-file-level Forth-path test for TTime: no TTime-containing ROOT test file is available in skhep_testdata; the fix is verified via source inspection and API-level assertions.

henryiii added 3 commits June 10, 2026 14:56
… TAtt

- TTree v18: rename `member_values` property to `member_names` so
  it matches every other version (v16/17/19/20) and is no longer silently
  shadowed by the empty base-class list.
- TTime: port `read_members` Forth path from the removed old API
  (get_gen_obj/get_keys/add_to_header/…) to the current Node-based API,
  mirroring TDatime.py; previously any Forth-path read raised AttributeError.
- TAtt: fix typo `fMarkserSize` -> `fMarkerSize` in
  Model_TAttMarker_v2.member_names.
- TTable: remove dead module-level `format` dict that shadowed the builtin
  and was never used; fix docstring (was "TTree", should be "TTable").
- TMatrixT: fix docstring (was "TLeaf and its subclasses", should be "TMatrixT").

Assisted-by: ClaudeCode:claude-sonnet-4-6
Add tests/test_1647_model_fixes.py covering:
- Model_TTree_v18.member_names returns a non-empty list (was misnamed
  member_values, silently falling back to the base-class empty list)
- Model_TAttMarker_v2.member_names has fMarkerSize (not the typo fMarkserSize)
- Model_TTime_v2.read_members Forth path uses the current Node-based API,
  not the removed old API methods
- TTable module-level `format` attribute no longer shadows the builtin

Assisted-by: ClaudeCode:claude-sonnet-4-6
Assisted-by: ClaudeCode:claude-fable-5
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.80%. Comparing base (1c06db0) to head (72b235d).
⚠️ Report is 13 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/uproot/models/TTime.py 14.28% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (33.33%) is below the target coverage (98.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
Files with missing lines Coverage Δ
src/uproot/models/TAtt.py 42.19% <100.00%> (ø)
src/uproot/models/TMatrixT.py 94.44% <ø> (ø)
src/uproot/models/TTable.py 86.51% <ø> (-0.15%) ⬇️
src/uproot/models/TTree.py 67.37% <100.00%> (+1.27%) ⬆️
src/uproot/models/TTime.py 39.58% <14.28%> (+5.65%) ⬆️

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