-
Notifications
You must be signed in to change notification settings - Fork 190
chore: add FileId repr (#1628) #1726
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
Changes from all commits
91247ac
130cc15
826d684
47db9d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,20 @@ def test_str_representation_default(): | |
| assert str(file_id) == "0.0.0" | ||
|
|
||
|
|
||
| def test_repr_representation(): | ||
| """Test repr representation of FileId.""" | ||
| file_id = FileId(0, 0, 150) | ||
|
|
||
| assert repr(file_id) == "FileId(shard=0, realm=0, file=150)" | ||
Subhrasameerdash marked this conversation as resolved.
Show resolved
Hide resolved
Subhrasameerdash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def test_repr_representation_with_checksum(): | ||
| """Test repr representation of FileId with checksum.""" | ||
| file_id = FileId.from_string("0.0.1-dfkxr") | ||
|
|
||
| assert repr(file_id) == "FileId(shard=0, realm=0, file=1)" | ||
|
Comment on lines
+55
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test asserts the wrong expected output — checksum should be included in Issue Proposed fix (aligns with the __repr__ fix) def test_repr_representation_with_checksum():
"""Test repr representation of FileId with checksum."""
file_id = FileId.from_string("0.0.1-dfkxr")
- assert repr(file_id) == "FileId(shard=0, realm=0, file=1)"
+ assert repr(file_id) == "FileId(shard=0, realm=0, file=1, checksum='dfkxr')", \
+ "repr should include checksum when checksum is not None" |
||
|
|
||
|
|
||
| def test_from_string_valid(): | ||
| """Test creating FileId from valid string format.""" | ||
| file_id = FileId.from_string("1.2.3") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.