• 
      

    Suppress errors when trying to generate stats for empty diffs.

    Review Request #11796 — Created Aug. 18, 2021 and submitted

    Information

    DiffX
    release-1.0.x

    Reviewers

    There are cases where a diffx diff section will have empty diff
    content--for example, when a file is renamed but doesn't have any
    changes to content. The diff stats generation will do the right thing if
    a file is added without specifying diff= in the constructor at all,
    but was spewing errors with diff=b''. This change updates things to
    check for falsiness rather than explicitly checking against None.

    • Ran with some code that was creating empty (but not None) diffs. Saw no
      more errors.
    • Ran unit tests.
    Summary ID
    Suppress errors when trying to generate stats for empty diffs.
    There are cases where a diffx diff section will have empty diff content--for example, when a file is renamed but doesn't have any changes to content. The diff stats generation will do the right thing if a file is added without specifying `diff=` in the constructor at all, but was spewing errors with `diff=b''`. This change updates things to check for falsiness rather than explicitly checking against `None`. Testing Done: - Ran with some code that was creating empty (but not `None`) diffs. Saw no more errors. - Ran unit tests.
    11826f22aebbad2586186e6e0fb55dda5173516a
    david
    chipx86
    1. Can you add a unit test for this? I'm aiming for 100% test coverage, so tests can be used as a starting point for verifying new implementations.

    2. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to pydiffx/release-1.x (fe417d4)