Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
16059483
Commit
16059483
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
2.11.0 again
parent
3405920d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/coding/predicates.rst
+1
-0
1 addition, 0 deletions
docs/coding/predicates.rst
satella/coding/predicates.py
+6
-0
6 additions, 0 deletions
satella/coding/predicates.py
tests/test_coding/test_predicates.py
+1
-1
1 addition, 1 deletion
tests/test_coding/test_predicates.py
with
8 additions
and
1 deletion
docs/coding/predicates.rst
+
1
−
0
View file @
16059483
...
...
@@ -69,3 +69,4 @@ Or check whether an instance is of provided type
::
p = x.instanceof(int)
assert p(2)
This diff is collapsed.
Click to expand it.
satella/coding/predicates.py
+
6
−
0
View file @
16059483
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tests/test_coding/test_predicates.py
+
1
−
1
View file @
16059483
...
...
@@ -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
]))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment