Skip to content

Wrappers for DAP validator functions that throw exceptions#329

Merged
kwmsmith merged 6 commits into
masterfrom
feature/exception-throwing-protocol-validator
Apr 21, 2014
Merged

Wrappers for DAP validator functions that throw exceptions#329
kwmsmith merged 6 commits into
masterfrom
feature/exception-throwing-protocol-validator

Conversation

@bgrant
Copy link
Copy Markdown
Contributor

@bgrant bgrant commented Apr 21, 2014

The functions in the Distributed Array Protocol validator return a (success, errmsg) tuple; however, when we use them in DistArray, we usually want to throw an exception when a structure doesn't validate. This PR adds three functions to testing.py:

validate_dim_dict
validate_dim_data
validate_distbuffer

which wrap the corresponding DAP validator functions but throw exceptions rather than return tuples. They all use the raise_exception decorator that I added to testing.py.

@kwmsmith
Copy link
Copy Markdown
Contributor

@bgrant could you add an AssertRaises test that exercises the decorator's logic?

@kwmsmith kwmsmith added this to the 0.3 milestone Apr 21, 2014
Incidentally, add the test file `distarray/tests/test_testing.py`.
@bgrant
Copy link
Copy Markdown
Contributor Author

bgrant commented Apr 21, 2014

@kwmsmith : Added some simple tests.

@kwmsmith
Copy link
Copy Markdown
Contributor

LGTM.

kwmsmith added a commit that referenced this pull request Apr 21, 2014
…tocol-validator

Wrappers for DAP validator functions that throw exceptions
@kwmsmith kwmsmith merged commit 0c380e2 into master Apr 21, 2014
@kwmsmith kwmsmith deleted the feature/exception-throwing-protocol-validator branch April 28, 2014 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants