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

660: nicer error about choices sheet when extension omitted in select_.._from_file #673

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

lindsay-stevens
Copy link
Contributor

Closes #660

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

Previously, an error about a missing sheet name may be thrown, e.g. if the form didn't contain any regular choices. This change explicitly checks for file extension, in order to show a nicer error message. The existing constants, aliases, and validation pattern are used.

What are the regression risks?

I think this is just an enhancement, since the old behaviour was confusing, and in both cases an error is raised.

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

No it's already documented in the template, just an easy mistake to make

image

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

…rm#602)

- found this issue because `error__contains` is the correct spelling, so
  the message was not being checked (the pyxformtestcase kwarg
  validation does not occur if the form has errors).
- the error for the entities sheet should report the problematic columns
  in the order they appear. Until XLSForm#602 is merged, the incoming dict
  may have random key order. This change avoids re-introducing the same
  sort of issue via set usage, instead doing the same with dict keys.
- to avoid tests randomly failing, test `error__contains` looks for
  each column individually.
- previously, an error about a missing sheet name may be thrown, e.g.
  if the form didn't contain any regular choices. This change explicitly
  checks for file extension, similar to external selects.
- added test case for all the combinations, and removed duplicative
  older tests
- added new alias subgroup for select..from_file to reduce duplication
@lognaturel lognaturel merged commit 017d130 into XLSForm:master Dec 1, 2023
10 checks passed
@lognaturel
Copy link
Contributor

Yay, @lindsay-stevens out here making my life so much better! (And hopefully that of other users, too 😊)

@lindsay-stevens lindsay-stevens deleted the pyxform-660 branch December 4, 2023 11:26
@lognaturel
Copy link
Contributor

Just got this error again, such a big improvement!

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.

Misleading error about choices sheet when extension omitted in select_one_from_file
2 participants