fix: coerce null eventType to empty string in _parse_card_note (#350)#351
Open
SAY-5 wants to merge 3 commits into
Open
fix: coerce null eventType to empty string in _parse_card_note (#350)#351SAY-5 wants to merge 3 commits into
SAY-5 wants to merge 3 commits into
Conversation
…org#350) Signed-off-by: SAY-5 <say.apm35@gmail.com>
Collaborator
|
Good catch. Could you maybe add a full test for an "Aktien erhalten" event? |
Author
|
Sure. I don't have a real 'Aktien erhalten' payload handy. From #350's traceback it looks like the original event had eventType=null and the title 'AI & Big Data USD (Acc) Aktien erhalten'. Do you have a sanitized fixture I can drop into tests/aktien_erhalten*.json, or is the existing aktiensplit_no_eventType.json (which already carries the 'Du hast Aktien aus einer Kapitalmaßnahme erhalten' header) close enough to repurpose? |
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.
Closes #350.
_parse_card_notereadsevent_dict.get("eventType", ""), butdict.get(k, default)only returns the default when the key is absent. The Trade Republic timeline includes "Aktien erhalten" (shares-received) entries where the key is present with valuenull, soeventTypeStrbecomesNoneand the next line'seventTypeStr.startswith("card_")nil-derefs, breakingpytr export_transactionsCSV export end-to-end.Replaces the default with
event_dict.get("eventType") or ""so both missing and null collapse to an empty string. Regression testtest_parse_card_note_returns_none_when_event_type_is_nullcovers the null case (the bug repro), the existing absent case, and the existing card_-prefix happy path.