Skip to content

Commit

Permalink
fixed type check in surf.query.validate_statement() as per issue co…
Browse files Browse the repository at this point in the history
  • Loading branch information
mromanello committed Feb 14, 2019
1 parent 91fb072 commit 0f12510
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion surf/query/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ def __str__(self):

def validate_statement(statement):
if isinstance(statement, tuple(Query.STATEMENT_TYPES + [Query])):
if isinstance(statement, (list, tuple)):
# since `NamedGroup` inherits from `list` via `Group` here we want
# to use `type()` instead of `isinstance()` as we need to tell
# whether `statement` is e.g. a list/tuple or an instance of
# `NamedGroup`
if type(statement) in [list, tuple]:
try:
s, p, o = statement
except:
Expand Down

0 comments on commit 0f12510

Please sign in to comment.