Skip to content
Snippets Groups Projects
Commit 16059483 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

2.11.0 again

parent 3405920d
No related branches found
No related tags found
No related merge requests found
......@@ -69,3 +69,4 @@ Or check whether an instance is of provided type
::
p = x.instanceof(int)
assert p(2)
......@@ -56,6 +56,12 @@ class Predicate:
"""
return make_operation_two_args(_one_of)(self, values)
def inside(self, value):
"""
Return a predicate checking if x is inside value
"""
return make_operation_two_args(operator.contains)(self, value)
def instanceof(self, instance):
"""
Return a predicate checking whether this value is an instance of instance
......
......@@ -53,7 +53,7 @@ class TestPredicates(unittest.TestCase):
self.assertFalse(p(4))
def test_contains(self):
p = 2 in x
p = x.inside(2)
self.assertTrue(p([1, 2]))
self.assertFalse(p([1, 3]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment