Skip to content

Commit

Permalink
add not expression
Browse files Browse the repository at this point in the history
  • Loading branch information
yukikaoru committed Dec 30, 2019
1 parent baa1024 commit 1eaf4a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions csrestructuredquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ class And(LogicalExpression):

class Or(LogicalExpression):
name = "or"


class Not(LogicalExpression):
name = "not"
7 changes: 6 additions & 1 deletion tests/test_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from csrestructuredquery.query import Query, And, Or
from csrestructuredquery.query import Query, And, Or, Not


def test_文字列型と日時型は引用符で括られる():
Expand All @@ -16,3 +16,8 @@ def test_AND論理演算子():
def test_OR論理演算子():
expr = Or(("foo", "hoge"), ("bar", 123))
assert expr.query() == "(or foo:'hoge' bar:123)"


def test_NOT論理演算子():
expr = Not(("foo", "hoge"), ("bar", 123))
assert expr.query() == "(not foo:'hoge' bar:123)"

0 comments on commit 1eaf4a8

Please sign in to comment.