Page MenuHomeSoftware Heritage

swh.search.get_search: Simplify instantiation
ClosedPublic

Authored by ardumont on Aug 2 2020, 11:11 AM.

Details

Summary

This aligns with other get_* functions.
This also adds tests to this part.

This is preparatory work to improve and add consistent types and docstrings without duplication or typos.

Related to T2516

Test Plan

tox

Diff Detail

Repository
rDSEA Archive search
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont created this revision.Aug 2 2020, 11:11 AM
ardumont edited the test plan for this revision. (Show Details)Aug 2 2020, 11:12 AM

Build is green

Patch application report for D3684 (id=12974)

Rebasing onto d285cd3f3b...

Current branch diff-target is up to date.
Changes applied before test
commit 58faacb5e95dc3bd9a55ec39c8bf06287b75879d
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Aug 2 11:05:07 2020 +0200

    swh.search.get_search: Simplify instantiation
    
    This aligns with other get_* functions.
    This also adds tests to this part.
    
    This is preparatory work to improve and type properly this module without
    duplication.
    
    Related to T645

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

vlorentz accepted this revision.Aug 3 2020, 9:14 AM
vlorentz added a subscriber: vlorentz.

great, thanks

swh/search/tests/test_init.py
23–27

you can use pytest.parametrize instead, but that's ok too

This revision is now accepted and ready to land.Aug 3 2020, 9:14 AM
ardumont edited the summary of this revision. (Show Details)Aug 3 2020, 9:54 AM
ardumont updated this revision to Diff 12977.Aug 3 2020, 10:07 AM

Use pytest parametrize instead

vlorentz requested changes to this revision.Aug 3 2020, 10:09 AM
vlorentz added inline comments.
swh/search/tests/test_init.py
28

"If a function argument's name clashes with a reserved keyword, it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption. Thus class_ is better than clss. (Perhaps better is to avoid such clashes by using a synonym.)"
https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments

This revision now requires changes to proceed.Aug 3 2020, 10:09 AM

Build is green

Patch application report for D3684 (id=12977)

Rebasing onto d285cd3f3b...

Current branch diff-target is up to date.
Changes applied before test
commit 58a7f7f0d1a288a7b54eb66b05ee2c0b7fe01e5c
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Aug 2 11:05:07 2020 +0200

    swh.search.get_search: Simplify instantiation
    
    This aligns with other get_* functions.
    This also adds tests to this part.
    
    This is preparatory work to improve and type properly this module without
    duplication.
    
    Related to T645

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

ardumont updated this revision to Diff 12978.Aug 3 2020, 10:30 AM

Use proper names

swh/search/tests/test_init.py
23–27

thanks!

Build is green

Patch application report for D3684 (id=12978)

Rebasing onto d285cd3f3b...

Current branch diff-target is up to date.
Changes applied before test
commit 46af49019c220ad4f398944bf43130bd26288cda
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Sun Aug 2 11:05:07 2020 +0200

    swh.search.get_search: Simplify instantiation
    
    This aligns with other get_* functions.
    This also adds tests to this part.
    
    This is preparatory work to improve and type properly this module without
    duplication.
    
    Related to T645

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

vlorentz accepted this revision.Aug 3 2020, 10:35 AM
This revision is now accepted and ready to land.Aug 3 2020, 10:35 AM
This revision was automatically updated to reflect the committed changes.