Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise exception when using add_if_missing on ownerless Asset #554

Conversation

duckontheweb
Copy link
Contributor

@duckontheweb duckontheweb commented Jul 13, 2021

Related Issue(s):

Description:

Raises an STACError if add_if_missing is True for an Asset with no owner.

This PR also moves the add_if_missing logic into ExtensionManagementMixin.validate_has_extension for DRYer code in the extension implementations.

PR Checklist:

  • Code is formatted (run pre-commit run --all-files)
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2021

Codecov Report

Merging #554 (30a272d) into main (660fd9a) will increase coverage by 0.00%.
The diff coverage is 89.83%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #554    /-   ##
=======================================
  Coverage   94.50%   94.50%           
=======================================
  Files          71       71           
  Lines       10703    10652   -51     
  Branches     1095     1065   -30     
=======================================
- Hits        10115    10067   -48     
  Misses        418      415    -3     
  Partials      170      170           
Impacted Files Coverage Δ
pystac/extensions/item_assets.py 66.66% <0.00%> ( 0.81%) ⬆️
pystac/extensions/pointcloud.py 95.43% <60.00%> (-0.07%) ⬇️
pystac/extensions/sar.py 98.58% <60.00%> (-0.02%) ⬇️
pystac/extensions/datacube.py 62.16% <66.66%> (-0.11%) ⬇️
pystac/extensions/base.py 93.44% <100.00%> ( 0.98%) ⬆️
pystac/extensions/eo.py 94.25% <100.00%> (-0.17%) ⬇️
pystac/extensions/file.py 92.06% <100.00%> (-0.13%) ⬇️
pystac/extensions/label.py 93.65% <100.00%> (-0.08%) ⬇️
pystac/extensions/projection.py 98.46% <100.00%> (-0.07%) ⬇️
pystac/extensions/raster.py 89.70% <100.00%> (-0.15%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 660fd9a...30a272d. Read the comment docs.

@duckontheweb duckontheweb requested a review from lossyrob July 13, 2021 13:11
@duckontheweb duckontheweb force-pushed the fix/gh-521-add-if-missing-asset-error branch from f0f4a40 to 5b25a43 Compare July 15, 2021 00:22
@duckontheweb duckontheweb requested a review from lossyrob July 15, 2021 14:52
@duckontheweb duckontheweb added this to the 1.0.0 milestone Jul 16, 2021
@duckontheweb duckontheweb merged commit 17c52ed into stac-utils:main Jul 16, 2021
@duckontheweb duckontheweb deleted the fix/gh-521-add-if-missing-asset-error branch July 17, 2021 15:58
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.

Extensions: Throw error if add_if_missing is used when called on an Asset without a parent
3 participants