зеркало из https://github.com/Azure/pykusto.git
Merge pull request #27 from Azure/adding-not_contains
adding not_contains
This commit is contained in:
Коммит
250a4d9cf6
|
@ -253,6 +253,9 @@ class StringExpression(BaseExpression):
|
|||
def contains(self, other: StringType, case_sensitive: bool = False) -> BooleanExpression:
|
||||
return BooleanExpression.binary_op(self, ' contains_cs ' if case_sensitive else ' contains ', other)
|
||||
|
||||
def not_contains(self, other: StringType, case_sensitive: bool = False) -> BooleanExpression:
|
||||
return BooleanExpression.binary_op(self, ' !contains_cs ' if case_sensitive else ' !contains ', other)
|
||||
|
||||
def startswith(self, other: StringType, case_sensitive: bool = False) -> BooleanExpression:
|
||||
return BooleanExpression.binary_op(self, ' startswith_cs ' if case_sensitive else ' startswith ', other)
|
||||
|
||||
|
|
|
@ -11,6 +11,20 @@ class TestExpressions(TestBase):
|
|||
' | where foo contains "bar"',
|
||||
Query().where(col.foo.contains('bar')).render(),
|
||||
)
|
||||
self.assertEqual(
|
||||
' | where foo contains_cs "bar"',
|
||||
Query().where(col.foo.contains('bar', True)).render(),
|
||||
)
|
||||
|
||||
def test_not_contains(self):
|
||||
self.assertEqual(
|
||||
' | where foo !contains "bar"',
|
||||
Query().where(col.foo.not_contains('bar')).render(),
|
||||
)
|
||||
self.assertEqual(
|
||||
' | where foo !contains_cs "bar"',
|
||||
Query().where(col.foo.not_contains('bar', True)).render(),
|
||||
)
|
||||
|
||||
def test_array_access(self):
|
||||
self.assertEqual(
|
||||
|
|
Загрузка…
Ссылка в новой задаче