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

Show error when there are save_tos in a repeat, simplify entities tests #636

Merged
merged 3 commits into from
Jan 19, 2023

Conversation

lognaturel
Copy link
Contributor

@lognaturel lognaturel commented Jan 17, 2023

Closes #633
Addresses part of #632

Why is this the best possible solution? Were any other approaches considered?

I decided to clean up entities tests here as suggested by @lindsay-stevens to make it easier to identify what test coverage there currently is.

It took me a little bit to decide how to check whether a row is in a repeat. There was no such functionality at that level (e.g. survey_element has it) and it's only needed in one place so I did it with an inline expression. I think it's easy enough to read and to test from the outside.

What are the regression risks?

This doesn't touch any existing logic. The worst case is probably that if my "in repeat" check is wrong we could be rejecting forms incorrectly.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run nosetests and verified all tests pass
  • run black pyxform tests to format code
  • verified that any code or assets from external sources are properly credited in comments

This was confusing because pyxform is often wrapped in other tools and users don't know what it is.
@lindsay-stevens
Copy link
Contributor

lindsay-stevens commented Jan 19, 2023

LGTM 👍

The worst case is probably that if my "in repeat" check is wrong we could be rejecting forms incorrectly.

Seems unlikely - there's a test to show that the check identifies a repeat successfully, the validation func checks that there's an entity binding before throwing any errors, and all other tests are passing. I can't currently think of any plausible way the new check would do the wrong thing - maybe if there was a group inside the repeat? Or the bound item wasn't the first in the repeat?

@lognaturel
Copy link
Contributor Author

maybe if there was a group inside the repeat? Or the bound item wasn't the first in the repeat?

Good cases to consider. I tried those as an extra sanity check and confirmed they're ok but don't think they're worth adding to the test suite.

@lognaturel lognaturel merged commit 3c9448a into XLSForm:master Jan 19, 2023
@lognaturel
Copy link
Contributor Author

Thank you so much, @lindsay-stevens 🎉

@lognaturel lognaturel deleted the entities-in-repeat branch January 19, 2023 20:11
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.

Show error when there are save_tos in a repeat
2 participants