Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for is_in operator #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion business_rules/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def non_empty(self):
return bool(self.value)

@type_operator(FIELD_TEXT)
def contains_in(self, other_string):
def is_in(self, other_string):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You really need a substring option? Or are you intending this to be about membership in a list of things?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

substring option

return self.value in other_string


Expand Down
6 changes: 3 additions & 3 deletions tests/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def test_non_empty(self):
self.assertFalse(StringType("").non_empty())
self.assertFalse(StringType(None).non_empty())

def test_string_contains_in(self):
self.assertTrue(StringType("hello").contains_in("hello world"))
self.assertFalse(StringType("word").contains_in("hello world"))
def test_string_is_in(self):
self.assertTrue(StringType("hello").is_in("hello world"))
self.assertFalse(StringType("word").is_in("hello world"))

class NumericOperatorTests(TestCase):

Expand Down