Skip to content
Snippets Groups Projects

Test refactor offline

Merged Zineb Aly requested to merge test-refactor-offline into refactor-offline
2 unresolved threads

this branch has additional tests for full coverage of offline (note Usr class is not tested). There is also an attempt to fix some bugs in the Header class.

Edited by Tamas Gal

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Tamas Gal
  • Tamas Gal
    Tamas Gal @tgal started a thread on the diff
  • 201 198 Constructor = namedtuple(attribute, fields)
    202 199 if len(values) < len(fields):
    203 200 values += [None] * (len(fields) - len(values))
    201 print(attribute, fields, values)
    204 202 self._data[attribute] = Constructor(
    205 203 **{f: _to_num(v)
    206 204 for (f, v) in zip(fields, values)})
    207 205
    206 # quick fix while waiting for additional definitions in mc_header
    207 for key in self._missing_keys:
    208 self._data[key] = _to_num(header[key])
    • So here is the crux, I think we should have dummy entries for every non-existent key. The code itself can go to the for-loop above while iterating over the keys in the file, instead of the known keys. Hope you understand what I mean ;) we can check for every item if it's in the existing mc_header.keys(), if not, we just name each entry field_1, field_2 etc.

    • If it's too confusing I can quickly implement to show what I mean. But I can also write a failing test where you see the output

    • Please register or sign in to reply
  • Tamas Gal
    Tamas Gal @tgal started a thread on the diff
  • 253 289 assert np.allclose(
    254 290 [37.51967774166617, -10.280346193553832, 13.67595659707355],
    255 291 self.f.events.usr.DeltaPosZ)
    292
    293
    294 class TestIndependentFunctions(unittest.TestCase):
    • I'd break these up into independent classes, but that's just a personal preference. I like to have one separate class for each function

    • Please register or sign in to reply
  • Looks good to me so far!

  • Zineb Aly added 1 commit

    added 1 commit

    • efded642 - Apply suggestion to km3io/offline.py

    Compare with previous version

  • Zineb Aly added 1 commit

    added 1 commit

    • 1fc501f6 - Apply suggestion to km3io/offline.py

    Compare with previous version

  • Tamas Gal unmarked as a Work In Progress

    unmarked as a Work In Progress

  • merged

  • Tamas Gal mentioned in commit c0892b66

    mentioned in commit c0892b66

  • Please register or sign in to reply
    Loading