-
Notifications
You must be signed in to change notification settings - Fork 32
Initial start of unit tests for pyth-client-py #3
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cctdaniel
reviewed
Nov 10, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple of comments regarding standardization
SEJeff
commented
Nov 10, 2021
Make the output a bit nicer
The rest will come once I've mocked out more of the SolanaClient bits.
This prevents SolanaClient from actually reaching out to any solana rpc nodes to keep things nice and hermetic for unit testing.
So multiple test files can use it.
The V1 parsing isn't as important and we might remove it in the future.
* Make a `price_account` fixture * Rename test_price_account() --> test_price_account_update_from() * Split out tests for aggregate confidence_interval and aggregate price * Move an assertion for the min_publishers to the end Thanks @cctdaniel
tony-ricciardi
approved these changes
Nov 15, 2021
This makes the code easier to read and makes the comparison less janky. * Updating PythPriceInfo to use datclass and flake8 updates * Updating PythPriceComponent to use a datclass * Updating PythPriceAccount tests to use dataclass * Update the binary bits to use base64 encoded bytes for brevity Nice review suggestion from @tony-ricciardi. Not yet using dataclass with PythProductAccount as there is some magic with the _prices attribute and the properties without full coverage yet. The tests were janky and I'll figure it out later when adding coverage for the various update bits.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is time to start writing some tests for the client. This is a start which will add tests mostly for the deserialise/update_from() methods for each major class in pythclient/pythaccounts.py one at a time. The goal is 100% test coverage of the binary parsing.
Also added
PythPriceAccount.min_publishers
since that is now in the most recent oracle.