Skip to content

Refactor tests, Delta.to_dict() #12 - #22

Merged
steven-esser merged 9 commits into
developfrom
12-license-info-for-modified-files
Nov 30, 2017
Merged

steven-esser merged 9 commits into
developfrom
12-license-info-for-modified-files

Conversation

@johnmhoran

Copy link
Copy Markdown
Member
  • 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

  * 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>
Comment thread src/deltacode/__init__.py Outdated
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]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can probably rename these variables to simply new_keys and old_keys

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@steven-esser
steven-esser merged commit 4449433 into develop Nov 30, 2017
@steven-esser
steven-esser deleted the 12-license-info-for-modified-files branch November 30, 2017 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants