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

fix: don't forward parent when getting artist radio #1211

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

tdambrin
Copy link
Contributor

@tdambrin tdambrin commented Dec 4, 2024

Fixes #1210

Description of change

  • Added a fwd_parent (bool) parameter in src/deezqer/resources/resource:Resource.get_relation. Default value to True
  • Set the fwd_parent to false when calling src/deezer/resources/artist:Artist.get_radio
  • Added assertion in tests/resources/test_artist.py:TestArtist.test_get_radio

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • This pull request follows the contributing guidelines.
  • This pull request links relevant issues as Fixes #0000 (replace 0000 with the actual issue number)
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec, such as "fix(api): prevent racing of requests".

Summary by Sourcery

Fix the bug where the artist radio incorrectly forwards the parent artist by introducing a fwd_parent parameter in the get_relation method and setting it to false for artist radio. Update tests to ensure tracks are from different artists.

Bug Fixes:

  • Fix the issue where the artist radio was incorrectly forwarding the parent artist by setting the fwd_parent parameter to false.

Tests:

  • Add an assertion in the test_get_radio test case to verify that tracks returned are from different artists.

Copy link
Contributor

sourcery-ai bot commented Dec 4, 2024

Reviewer's Guide by Sourcery

This PR fixes a bug related to parent-child relationships in artist radio functionality. The implementation adds a new fwd_parent parameter to the get_relation method, allowing control over whether the parent reference is forwarded. For artist radio, the parent reference is disabled since radio tracks can come from different artists.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added control over parent-child relationship forwarding in resource relations
  • Added new fwd_parent boolean parameter with default value True
  • Modified parent assignment to be conditional based on fwd_parent parameter
src/deezer/resources/resource.py
Disabled parent forwarding for artist radio tracks
  • Set fwd_parent to False when getting artist radio
  • Added comment explaining why parent forwarding is disabled for radio
src/deezer/resources/artist.py
Enhanced test coverage for artist radio functionality
  • Added assertion to verify that radio tracks come from different artists
tests/resources/test_artist.py

Assessment against linked issues

Issue Objective Addressed Explanation
#1210 Fix the Artist.get_radio method to return tracks with their correct artists instead of setting all tracks' artists to the parent artist

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tdambrin - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.86%. Comparing base (cf934bf) to head (9fc7d64).
Report is 20 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1211   +/-   ##
=======================================
  Coverage   99.86%   99.86%           
=======================================
  Files          20       20           
  Lines         723      723           
  Branches       46       46           
=======================================
  Hits          722      722           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@browniebroke browniebroke changed the title Fixes #1210 bug: no forward parent when getting artist radio fix: don't forward parent when getting artist radio Dec 20, 2024
@browniebroke browniebroke merged commit 6807997 into browniebroke:main Dec 20, 2024
16 checks passed
@browniebroke
Copy link
Owner

Thanks! Nice fix

@browniebroke
Copy link
Owner

@all-contributors please add @tdambrin for bug

Copy link
Contributor

@browniebroke

I've put up a pull request to add @tdambrin! 🎉

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.

[Artist.get_radio] All tracks have the parent as artist
2 participants