Page MenuHomeSoftware Heritage

test_identifiers.py: Fix/update malformed data dicts
ClosedPublic

Authored by vlorentz on Sep 22 2021, 5:47 PM.

Details

Summary

A future commit will make identifier computation use the attrs classes,
which are strict about what they accept.

Diff Detail

Event Timeline

Build is green

Patch application report for D6324 (id=22978)

Could not rebase; Attempt merge onto b6f5e30b53...

Updating b6f5e30..209356f
Fast-forward
 swh/model/identifiers.py            | 455 +-----------------------------------
 swh/model/model.py                  |   8 +-
 swh/model/swhids.py                 | 448 +++++++++++++++++++++++++++++++++++
 swh/model/tests/test_identifiers.py |  69 +++---
 4 files changed, 489 insertions(+), 491 deletions(-)
 create mode 100644 swh/model/swhids.py
Changes applied before test
commit 209356fc6704070bbac0b5f09b9c2e0c9aa2f12c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Sep 22 17:19:10 2021 +0200

    test_identifiers.py: Fix/update malformed data dicts
    
    A future commit will make identifier computation use the attrs classes,
    which are strict about what they accept.

commit d08b45c8766ec82ef9b47c30e2d574e279a0e37e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Sep 22 16:36:30 2021 +0200

    Move SWHID classes and functions from identifiers.py to swhids.py
    
    identifiers.py initially worked only on bare sha1_git.
    
    I chose to add the SWHID classes in that module because
    of the name, but the SWHID code didn't actually interact
    with the other functions in the module, so it now feels
    out of place to me.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/373/ for more details.

Is the broken_dates hunk supposed to be part of this diff? Looks out of place.

I've pointed out a couple of out of place b"\x12\x43\x..." strings that may benefit from _x()ification.

swh/model/tests/test_identifiers.py
539

turn this into a _x() call?

569

This one too?

638

And this one as well.

In D6324#163917, @olasd wrote:

Is the broken_dates hunk supposed to be part of this diff? Looks out of place.

I didn't know what to do with it. It doesn't make sense anymore since it would raise a mypy error after the refactoring.

I've pointed out a couple of out of place b"\x12\x43\x..." strings that may benefit from _x()ification.

There's a bunch more of them and I'm lazy :(

This revision is now accepted and ready to land.Sep 23 2021, 10:25 AM
This revision was landed with ongoing or failed builds.Sep 23 2021, 7:55 PM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D6324 (id=23019)

Could not rebase; Attempt merge onto 0dd33cdf7d...

Updating 0dd33cd..6a72f88
Fast-forward
 swh/model/identifiers.py            | 455 +-----------------------------------
 swh/model/model.py                  |   8 +-
 swh/model/swhids.py                 | 448 +++++++++++++++++++++++++++++++++++
 swh/model/tests/test_identifiers.py |  69 +++---
 4 files changed, 489 insertions(+), 491 deletions(-)
 create mode 100644 swh/model/swhids.py
Changes applied before test
commit 6a72f88c5687f5b6c05f9b25eb73bce2d772f97c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Sep 22 17:19:10 2021 +0200

    test_identifiers.py: Fix/update malformed data dicts
    
    A future commit will make identifier computation use the attrs classes,
    which are strict about what they accept.

commit 9ec683264c415731286005dff823e1099ef358c3
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Sep 22 16:36:30 2021 +0200

    Move SWHID classes and functions from identifiers.py to swhids.py
    
    identifiers.py initially worked only on bare sha1_git.
    
    I chose to add the SWHID classes in that module because
    of the name, but the SWHID code didn't actually interact
    with the other functions in the module, so it now feels
    out of place to me.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/385/ for more details.