Correctly return line counts in the FileDiffCollectionMixin

Review Request #10099 — Created July 24, 2018 and updated

brennie
Review Board
release-4.0.x
10094
b2f5893...
reviewboard

The FileDiffCollectionMixin incorrectly assumed that counts would
always be integers. However, before chunks are generated, some line
counts may be None. This patch works around that limitation and
returns the correct result for that case. Unit tests have been added to
test this behaviour.

Ran unit tests.

  • 0
  • 0
  • 15
  • 0
  • 15
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

brennie
chipx86
  1. 
      
  2. reviewboard/diffviewer/models/mixins.py (Diff revision 2)
     
     
     
     
     
     

    This would be nicer as:

    if value:
        if counts[key] is None:
            counts[key] = value
        else:
            counts[key] += value
    
  3. Missing a test docstring.

  4. reviewboard/diffviewer/tests/test_models_mixins.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     

    Is this the start of a brand new set of tests? If so, it should be its own test.

  5. 
      
brennie
Review request changed

Change Summary:

Addressed feedback.

Commit:

-35647a0eb4bd6008cd6ddd7c440847f04f1d75b6
+fb4a24af3a0d32fe4e27cca790011e21b8e46756

Diff:

Revision 3 (+136 -2)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

brennie
Review request changed

Commit:

-fb4a24af3a0d32fe4e27cca790011e21b8e46756
+b2f5893ccbe157c8c8317204b8998dd86d33f793

Diff:

Revision 4 (+135 -2)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
Loading...