Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty elements are no longer removed when deserializing a BoM file #546

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

Andy-Grigg
Copy link
Collaborator

Closes #545

Standardizes the options used when deserializing a BoM from a file and from a string. Previously, keep_empty=True was only specified when reading a BoM from string, which caused a weird asymmetry in some situations.

This PR removes this duplication, and adds some tests that check deserializing and round-tripping a BoM with an empty element works both via a file and via text.

@Andy-Grigg Andy-Grigg requested a review from da1910 May 31, 2024 22:20
@github-actions github-actions bot added the bug Something isn't working label May 31, 2024
@@ -80,33 +86,54 @@ def _compare_boms(*, source_bom: str, result_bom: str):
output_lines.append(diff_item)
return output_lines

def test_roundtrip_from_text_with_assertions(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff here is garbled. I basically duplicated the two existing tests, but passing in a path instead of a string

Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.63%. Comparing base (7e145a1) to head (18890b6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #546      +/-   ##
==========================================
+ Coverage   97.43%   97.63%   +0.19%     
==========================================
  Files          18       18              
  Lines        2539     2542       +3     
==========================================
+ Hits         2474     2482       +8     
+ Misses         65       60       -5     
Flag Coverage Δ
integration 83.16% <33.33%> (-0.06%) ⬇️
unittests 97.08% <100.00%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@da1910 da1910 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks about right to me, no idea why I didnt make it trim empty elements in all cases... I had it in mind that somewhere we actually needed the other behaviour but I can't remember where or why

@Andy-Grigg
Copy link
Collaborator Author

Looks about right to me, no idea why I didnt make it trim empty elements in all cases... I had it in mind that somewhere we actually needed the other behaviour but I can't remember where or why

The new behavior is the converse, we keep empty elements in all cases, so as to be compliant with the schema.

@Andy-Grigg Andy-Grigg added this pull request to the merge queue Jun 3, 2024
Merged via the queue into main with commit 2a692f6 Jun 3, 2024
44 checks passed
@Andy-Grigg Andy-Grigg deleted the fix/deserialize-from-file branch June 3, 2024 13:18
Andy-Grigg added a commit that referenced this pull request Jun 3, 2024
)

Co-authored-by: pyansys-ci-bot <pyansys.github.bot@ansys.com>
@Andy-Grigg Andy-Grigg mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BoMs generated by Gateways cannot be deserialized and serialized using the BoMHandler class
3 participants