Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
erp5
Commits
dae5899e
Commit
dae5899e
authored
Feb 19, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testPredicate: Fix pylint errors and warnings.
parent
2d6d1556
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
43 deletions
+2
-43
product/ERP5/tests/testPredicate.py
product/ERP5/tests/testPredicate.py
+2
-43
No files found.
product/ERP5/tests/testPredicate.py
View file @
dae5899e
...
...
@@ -33,7 +33,6 @@
import
unittest
from
Products.ERP5Type.Document
import
newTempMovement
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -333,46 +332,6 @@ class TestPredicates(TestPredicateMixIn):
membership_criterion_category_list
=
[
'not_exist/nothing'
])
self
.
assertFalse
(
pred
.
test
(
doc
))
def
test_PropertyCriterion
(
self
):
movement
=
newTempMovement
(
self
.
portal
,
'tmp'
)
predicate
=
self
.
createPredicate
()
predicate
.
setCriterionPropertyList
([
'quantity'
])
request
=
self
.
portal
.
REQUEST
request
.
set
(
'listbox'
,
{
'quantity'
:
{
'max'
:
''
,
'identity'
:
[],
'min'
:
''
}},
)
predicate
.
Predicate_edit
(
'Predicate_view'
)
self
.
assertEqual
(
predicate
.
_identity_criterion
,
{
'quantity'
:
[]})
self
.
assertEqual
(
predicate
.
_range_criterion
,
{})
self
.
assertTrue
(
predicate
.
test
(
movement
))
request
.
set
(
'listbox'
,
{
'quantity'
:
{
'max'
:
''
,
'identity'
:
[],
'min'
:
1.0
}},
)
predicate
.
Predicate_edit
(
'Predicate_view'
)
self
.
assertEqual
(
predicate
.
_range_criterion
,
{
'quantity'
:
(
1.0
,
None
)})
self
.
assertFalse
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
0.5
)))
self
.
assertTrue
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
1.0
)))
request
.
set
(
'listbox'
,
{
'quantity'
:
{
'max'
:
2.0
,
'identity'
:
[],
'min'
:
''
}},
)
predicate
.
Predicate_edit
(
'Predicate_view'
)
self
.
assertEqual
(
predicate
.
_range_criterion
,
{
'quantity'
:
(
None
,
2.0
)})
self
.
assertFalse
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
2.0
)))
self
.
assertTrue
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
1.5
)))
request
.
set
(
'listbox'
,
{
'quantity'
:
{
'max'
:
2.0
,
'identity'
:
[],
'min'
:
1.0
}},
)
predicate
.
Predicate_edit
(
'Predicate_view'
)
self
.
assertEqual
(
predicate
.
_range_criterion
,
{
'quantity'
:
(
1.0
,
2.0
)})
self
.
assertFalse
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
0.5
)))
self
.
assertTrue
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
1.0
)))
self
.
assertTrue
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
1.5
)))
self
.
assertFalse
(
predicate
.
test
(
movement
.
asContext
(
quantity
=
2.0
)))
def
test_EmptyPredicates
(
self
):
# empty predicate are true
doc
=
self
.
createDocument
()
...
...
@@ -592,7 +551,7 @@ class TestPredicates(TestPredicateMixIn):
self
.
assert_
(
test
(
predicate_with_membership_values
.
searchResults
))
def
test_PropertyCriterion
(
self
):
movement
=
newTempMovement
(
self
.
portal
,
'tmp'
)
movement
=
self
.
portal
.
newContent
(
temp_object
=
True
,
portal_type
=
'Movement'
,
id
=
'tmp'
)
predicate
=
self
.
createPredicate
()
predicate
.
setCriterionPropertyList
([
'quantity'
])
request
=
self
.
portal
.
REQUEST
...
...
@@ -660,7 +619,7 @@ class TestPredicates(TestPredicateMixIn):
# check that if the filter define more properties, we cannot have more than
# the one defined on the predicate
currency_module
=
self
.
portal
.
getDefaultModule
(
'Currency'
)
euro
=
currency_module
.
newContent
(
title
=
'euro'
)
currency_module
.
newContent
(
title
=
'euro'
)
self
.
assertEqual
({
fabien
,
nexedi
},
{
x
.
getObject
()
for
x
in
predicate
.
searchResults
(
portal_type
=
(
'Person'
,
'Organisation'
))})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment