-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More XPath 3 functions, plus count() now works on sequences.
- Loading branch information
Showing
4 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
from hq.hquery.object_type import is_node_set | ||
from hq.hquery.object_type import is_node_set, is_sequence | ||
|
||
|
||
class HqueryEvaluationError(RuntimeError): | ||
|
||
@classmethod | ||
def must_be_node_set(cls, presumed_node_set): | ||
if not is_node_set(presumed_node_set): | ||
raise HqueryEvaluationError('Expected a node set, but found a(n) {0}'.format(presumed_node_set.__class__.__name__)) | ||
def must_be_node_set(cls, obj): | ||
if not is_node_set(obj): | ||
raise HqueryEvaluationError('Expected a node set, but found a(n) {0}'.format(obj.__class__.__name__)) | ||
|
||
@classmethod | ||
def must_be_node_set_or_sequence(cls, obj): | ||
if not (is_node_set(obj) or is_sequence(obj)): | ||
raise HqueryEvaluationError('Expected a node set or sequence, but found a(n) {0}'.format( | ||
obj.__class__.__name__ | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters