Refactor tests, Delta.to_dict() #12 - #22
Merged
Merged
Conversation
* Includes cutoff for license scores <= 50 and related tests. Signed-off-by: John M. Horan <johnmhoran@gmail.com>
* Refactor using list comprehension. * Added no-license-info tests. Signed-off-by: John M. Horan <johnmhoran@gmail.com>
* Added 'license_changes' category to deltas OrderedDict.
* Added 'DeltaCode.modified_lic_diff()' function -- called from
'DeltaCode.determine_delta()' -- returning list of 'modified' Delta
objects with license changes that satisfy the test in
'Delta.license_diff()'.
* Added 2 sets of short test scans and related tests.
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
* Added more tests and sets of test scan files to test license-change
method and related functions.
* Modified 'get_license_keys' helper function.
* Other minor refactoring.
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
* Remove 'license_changes' category from the OrderedDict in
'DeltaCode.determine_delta()'.
* Refactor call to 'Delta.license_diff()' from inside
'DeltaCode.determine_delta()'.
* Refactor 'Delta.license_diff()'.
* Refactor 'Delta.to_dict()' to return an OrderedDict with the
category = 'license change' if self.category == 'license change'.
* Fix failing tests, add new tests including for CSVs.
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
* Use 'self.new_file.path' rather than 'self.old_file.path' in
'Delta.to_dict()' as appropriate.
* Added explanatory comment for call to 'delta.license_diff()' from
'DeltaCode.determine_delta()'.
* Deleted helper function from 'test_deltacode.py', refactored
related tests accordingly.
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
steven-esser
suggested changes
Nov 30, 2017
| cutoff_score = 50 | ||
|
|
||
| if self.new_file.licenses: | ||
| new_file_keys = [l.key for l in self.new_file.licenses if l.score >= cutoff_score] |
Contributor
There was a problem hiding this comment.
We can probably rename these variables to simply new_keys and old_keys
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
steven-esser
approved these changes
Nov 30, 2017
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.
self.new_file.pathrather thanself.old_file.pathinDelta.to_dict()as appropriate.Delta.license_diff()fromDeltaCode.determine_delta().test_deltacode.py, refactoredrelated tests accordingly.
Signed-off-by: John M. Horan johnmhoran@gmail.com