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

Add eq and str for token #191

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

EtienneWallet
Copy link
Contributor

Context

Currently the classses Token and TokenTransfer cannot be compared

>>>Token("NFT-123456", 777) == Token("NFT-123456", 777)
False

and they are displayed as object

>>>print(Token("NFT-123456", 777))
<multiversx_sdk.core.tokens.Token object at 0x75c4c8349550>

Proposed Changes

implement __eq__ and __str__ for Token and TokenTransfer

Copy link
Collaborator

@popenta popenta left a comment

Choose a reason for hiding this comment

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

Looks good, but add some tests for inequality for both Token and TokenTransfer.

Copy link

github-actions bot commented Jan 27, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  multiversx_sdk/core
  tokens.py
Project Total  

This report was generated by python-coverage-comment-action

@EtienneWallet
Copy link
Contributor Author

Looks good, but add some tests for inequality for both Token and TokenTransfer.

Indeed, it should have been there from the start: thanks!

it is now added

Copy link
Collaborator

@popenta popenta left a comment

Choose a reason for hiding this comment

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

💯 % test coverage looks awesome!

@popenta popenta merged commit c1c5893 into multiversx:feat/next Jan 28, 2025
4 checks passed
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.

3 participants