Skip to content

Commit

Permalink
add test nested syntax on logical expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
yukikaoru committed Dec 30, 2019
1 parent 1eaf4a8 commit b5bbe9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csrestructuredquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def query(self) -> str:
if isinstance(expr, tuple):
q += f" {expr[0]}:{ExpressionValue(expr[1])}"
else:
q += expr.query()
q += f" {expr.query()}"
q += ")"
return q

Expand Down
5 changes: 5 additions & 0 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ def test_OR論理演算子():
def test_NOT論理演算子():
expr = Not(("foo", "hoge"), ("bar", 123))
assert expr.query() == "(not foo:'hoge' bar:123)"


def test_論理演算子は入れ子にできる():
expr = And(("foo", "hoge"), Or(("bar", 123), Not(("baz", datetime(2013, 1, 23, 12, 34, 56)))))
assert expr.query() == "(and foo:'hoge' (or bar:123 (not baz:'2013-01-23T12:34:56')))"

0 comments on commit b5bbe9b

Please sign in to comment.