Skip to content

#271: Added method relative_to to interface PathLike#272

Merged
ckunki merged 5 commits intomainfrom
feature/271-Added_method_relative_to
Feb 2, 2026
Merged

#271: Added method relative_to to interface PathLike#272
ckunki merged 5 commits intomainfrom
feature/271-Added_method_relative_to

Conversation

@ckunki
Copy link

@ckunki ckunki commented Jan 30, 2026

Closes #271

Submission Checklist

  • Did you mention the issue which this pull request closes ("Closes ...")?
  • Updated the changelog in file doc/changes/unreleased.md

If required

  • Updated Documentation
  • Updated API Documentation

If doing a release

  • Bumped version number using poetry run -- nox -s release:prepare

@ckunki ckunki temporarily deployed to manual-approval January 30, 2026 13:15 — with GitHub Actions Inactive
pass


def test_relative_not_bucket_path(bucket_fake):
Copy link

Choose a reason for hiding this comment

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

what's the difference of this test compared to test_foreign_bucket?

Copy link
Author

@ckunki ckunki Feb 2, 2026

Choose a reason for hiding this comment

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

This test deliberately uses an instance of class NotBucketPath instead of bfs.path.BucketPath to verify the if statement in the implementation.

Copy link

Choose a reason for hiding this comment

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

Hm, but both test basically tes tthe if statement at line 347:

        if self._bucket_api != other.bucket_api:
            raise BucketFsError(
                "BucketPath.relative_to() called with other"
                f" from a foreign bucket {other._bucket_api}."
            )

=> Also the expected error message is probably the same.
Or do I get something wrong...

Copy link
Author

Choose a reason for hiding this comment

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

Many thanks for being persistent on this.
I finally found the problem and (hopefully) fixed it.
Please review again.

Copy link

Choose a reason for hiding this comment

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

Now it makes sense

@ckunki ckunki temporarily deployed to manual-approval February 2, 2026 12:32 — with GitHub Actions Inactive
tomuben
tomuben previously approved these changes Feb 2, 2026
def parent(self) -> PathLike:
return BucketPath(self._path.parent, self._bucket_api)

def relative_to(self, other_pathlike: PathLike) -> PurePath:
Copy link

Choose a reason for hiding this comment

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

this needs a docstring, to explain what exactly the result is

Copy link
Author

@ckunki ckunki Feb 2, 2026

Choose a reason for hiding this comment

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

Please see the docstring in the public interface PathLike instead, which I additionally updated based on our discussion.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

@ckunki ckunki merged commit e69f928 into main Feb 2, 2026
39 checks passed
@ckunki ckunki deleted the feature/271-Added_method_relative_to branch February 2, 2026 16:34
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.

Investigate enhancing interface PathLike to support computing relative paths

3 participants