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

docval with string enum should allow default value of None #408

Closed
5 tasks done
rly opened this issue Jul 22, 2020 · 1 comment · Fixed by #409
Closed
5 tasks done

docval with string enum should allow default value of None #408

rly opened this issue Jul 22, 2020 · 1 comment · Fixed by #409
Labels
category: bug errors in the code or code behavior

Comments

@rly
Copy link
Contributor

rly commented Jul 22, 2020

Description

The following docval argument raises an error:

{'name': 'continuity', 'type': str, 'default': None, 'enum': ["continuous", "instantaneous", "step"],
'doc': 'Optionally describe the continuity of the data.'}

Docval should allow this use case of an optional field where, when provided, the value must be an item from the list. Alternatively, the enum list should include None, but that seems ugly.

Environment

Python Executable: Python
Python Version: Python 3.8
Operating System: Windows
HDMF Version: dev

Checklist

  • Have you ensured the feature or change was not already reported ?
  • Have you included a brief and descriptive title?
  • Have you included a clear description of the problem you are trying to solve?
  • Have you included a minimal code snippet that reproduces the issue you are encountering?
  • Have you checked our Contributing document?
@rly rly added the category: bug errors in the code or code behavior label Jul 22, 2020
@rly
Copy link
Contributor Author

rly commented Jul 22, 2020

This is blocking NeurodataWithoutBorders/pynwb#1226

@rly rly closed this as completed in #409 Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant