Fix tag value writer#517
Merged
meretp merged 3 commits intospdx:refactor-python-toolsfrom Mar 10, 2023
Merged
Conversation
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Collaborator
armintaenzertng
left a comment
There was a problem hiding this comment.
Thanks for the fix, I have just some stylistic remarks.
Comment on lines
37
to
40
| m = mock_open() | ||
| with patch("{}.open".format(__name__), m, create=True): | ||
| with open("foo", "w") as h: | ||
| write_creation_info(creation_info, h) |
Collaborator
There was a problem hiding this comment.
I get that they are throw-away variables, but can we give m and h slightly more descriptive names?
| m.assert_called_once_with("foo", "w") | ||
| handle = m() | ||
| handle.write.assert_has_calls( | ||
| expected_calls) |
Collaborator
There was a problem hiding this comment.
Unnecessary line break
| call("Created: 2022-03-10T00:00:00Z\n")])]) | ||
| def test_creation_info_writer(creation_info, expected_calls): | ||
| m = mock_open() | ||
| with patch("{}.open".format(__name__), m, create=True): |
Collaborator
There was a problem hiding this comment.
Why not use an f-string here?
Collaborator
Author
There was a problem hiding this comment.
fixed, I just copied the code from test_package_writer.py. I would suggest to change the formatted string there when fixing #394 is fixed, okay?
Collaborator
There was a problem hiding this comment.
I'd prefer fixing it now so that next time it is not copied from there again ;)
armintaenzertng
approved these changes
Mar 10, 2023
ffd5fb3 to
63797e2
Compare
added 2 commits
March 10, 2023 16:04
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
… names Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
63797e2 to
b48ddf2
Compare
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.
Due to the type conversion before entering the
set_valuemethod aNonevalue forLicenseListVersionwas written to the outptut file. Thef-stringcalls the implementedstr-conversion for the instance ofVersion, so we don't need to do this conversion explicitly.To improve the test coverage here, I also added a test.