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

Ensure equal constructed and parsed keyword objects #94

Merged
merged 8 commits into from
May 31, 2023

Conversation

aphedges
Copy link
Collaborator

I while working on the ALLAN bot, I encountered a bug where SUP.province_no_coast was being parsed to the wrong type. I fixed it, but I figured I should check for similar cases. It turns out that although we had full coverage of the form assert str(daide_obj) == daide_str, we had no checks for the form assert daide_object == parse_daide(daide_str). I have added these checks, fixed the cases where they did not passed, and made some small changes for other problems I noticed during the process.

aphedges added 8 commits May 27, 2023 00:17
The grammar, the spec, and the field's type annotation all say that the
field's value should be a province without its coast, but the object
constructed through parsing had a `Location` in the field instead.

I have fixed `DAIDEVisitor` to construct the object properly, added code
to fix an incorrectly passed-in type (like some other objects do), and
added tests to ensure there are no regressions.
Hashability tests were added to all press keywords, but I wanted to make
sure base keywords were also tested the same way.
It was likely left in by mistake.
This based on code I wrote for the ALLAN bot.
I fixed `SUP` earlier, but I figured I should ensure all objects could
be constructed properly. I fixed cases where they could not be.
The same case is tested in the `test_PCE_bad()` function.
The original intention was clear from neighboring functions.
@aphedges
Copy link
Collaborator Author

@mjspeck and @bpshaver, can I please get a review on this?

@mjspeck
Copy link
Collaborator

mjspeck commented May 31, 2023

@aphedges I'll review it now.

@mjspeck mjspeck self-requested a review May 31, 2023 17:47
Copy link
Collaborator

@mjspeck mjspeck left a comment

Choose a reason for hiding this comment

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

Thanks for adding the additional parsing checks. LGTM!

src/daidepp/keywords/base_keywords.py Show resolved Hide resolved
@mjspeck
Copy link
Collaborator

mjspeck commented May 31, 2023

@aphedges do you have a preference on how we merge this?

@aphedges
Copy link
Collaborator Author

@mjspeck, thanks for the review!

I would prefer you merge it with a merge commit so you can keep the history.

@mjspeck mjspeck merged commit 1cfc75a into SHADE-AI:main May 31, 2023
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.

2 participants