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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
79a88d5d
Commit
79a88d5d
authored
Feb 01, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testXMLMatrix: py3
parent
f9de865c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testXMLMatrix.py
...TemplateItem/portal_components/test.erp5.testXMLMatrix.py
+14
-14
No files found.
bt5/erp5_trade/TestTemplateItem/portal_components/test.erp5.testXMLMatrix.py
View file @
79a88d5d
...
@@ -87,7 +87,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -87,7 +87,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
,
'3'
],
[
'a'
,
'b'
,
'c'
]]
cell_range
=
[[
'1'
,
'2'
,
'3'
],
[
'a'
,
'b'
,
'c'
]]
kwd
=
{
'base_id'
:
'quantity'
}
kwd
=
{
'base_id'
:
'quantity'
}
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
...
@@ -98,7 +98,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -98,7 +98,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'2'
,
'3'
,
'4'
],
[
'b'
,
'c'
,
'd'
]]
cell_range
=
[[
'2'
,
'3'
,
'4'
],
[
'b'
,
'c'
,
'd'
]]
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -109,7 +109,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -109,7 +109,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
,
'3'
,
'4'
],
[
'a'
,
'b'
,
'c'
,
'd'
]]
cell_range
=
[[
'1'
,
'2'
,
'3'
,
'4'
],
[
'a'
,
'b'
,
'c'
,
'd'
]]
value_list
=
(
0
,
1
,
2
,
None
,
3
,
4
,
5
,
None
,
6
,
7
,
8
,
None
,
None
,
None
,
None
,
None
)
value_list
=
(
0
,
1
,
2
,
None
,
3
,
4
,
5
,
None
,
6
,
7
,
8
,
None
,
None
,
None
,
None
,
None
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -123,7 +123,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -123,7 +123,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
],
[
'a'
,
'b'
]]
cell_range
=
[[
'1'
,
'2'
],
[
'a'
,
'b'
]]
value_list
=
(
0
,
1
,
3
,
4
)
value_list
=
(
0
,
1
,
3
,
4
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -134,7 +134,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -134,7 +134,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'3'
],
[
'a'
,
'b'
,
'c'
],
[
'A'
,
'B'
,
'C'
]]
cell_range
=
[[
'3'
],
[
'a'
,
'b'
,
'c'
],
[
'A'
,
'B'
,
'C'
]]
value_list
=
(
0
,
None
,
None
,
1
,
None
,
None
,
None
,
None
,
None
)
value_list
=
(
0
,
None
,
None
,
1
,
None
,
None
,
None
,
None
,
None
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -148,7 +148,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -148,7 +148,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
],
[
'A'
,
'B'
]]
cell_range
=
[[
'1'
,
'2'
],
[
'A'
,
'B'
]]
value_list
=
(
0
,
1
,
None
,
None
)
value_list
=
(
0
,
1
,
None
,
None
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -169,7 +169,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -169,7 +169,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
],
[
'A'
,
'B'
],
[
'a'
,
'b'
]]
cell_range
=
[[
'1'
,
'2'
],
[
'A'
,
'B'
],
[
'a'
,
'b'
]]
value_list
=
(
0
,
None
,
1
,
None
,
2
,
None
,
3
,
None
)
value_list
=
(
0
,
None
,
1
,
None
,
2
,
None
,
3
,
None
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
renameCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
i
=
0
i
=
0
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
cell
=
matrix
.
getCell
(
*
place
,
**
kwd
)
...
@@ -197,7 +197,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -197,7 +197,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
,
'3'
],
[
'a'
,
'b'
,
'c'
]]
cell_range
=
[[
'1'
,
'2'
,
'3'
],
[
'a'
,
'b'
,
'c'
]]
kwd
=
{
'base_id'
:
'quantity'
}
kwd
=
{
'base_id'
:
'quantity'
}
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
for
place
in
cartesianProduct
(
cell_range
):
for
place
in
cartesianProduct
(
cell_range
):
matrix
.
newCell
(
portal_type
=
"Purchase Order Cell"
,
matrix
.
newCell
(
portal_type
=
"Purchase Order Cell"
,
...
@@ -211,7 +211,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -211,7 +211,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
# We must commit transaction in order to put cell reindexing in activity queue
# We must commit transaction in order to put cell reindexing in activity queue
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
next_cell_id_list
=
list
(
matrix
.
objectIds
())
next_cell_id_list
=
list
(
matrix
.
objectIds
())
# the cells on coordinates 2b, 3b, 3b and 3c are kept
# the cells on coordinates 2b, 3b, 3b and 3c are kept
self
.
assertEqual
(
4
,
len
(
next_cell_id_list
))
self
.
assertEqual
(
4
,
len
(
next_cell_id_list
))
...
@@ -231,7 +231,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -231,7 +231,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'0'
,
'1'
],
[
'a'
,
'b'
]]
cell_range
=
[[
'0'
,
'1'
],
[
'a'
,
'b'
]]
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
next2_cell_id_list
=
list
(
matrix
.
objectIds
())
next2_cell_id_list
=
list
(
matrix
.
objectIds
())
removed_id_list
=
[
x
for
x
in
next_cell_id_list
if
x
not
in
next2_cell_id_list
]
removed_id_list
=
[
x
for
x
in
next_cell_id_list
if
x
not
in
next2_cell_id_list
]
self
.
tic
()
self
.
tic
()
...
@@ -244,7 +244,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -244,7 +244,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
kwd
=
{
'base_id'
:
'movement'
}
kwd
=
{
'base_id'
:
'movement'
}
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
self
.
tic
()
self
.
tic
()
for
id_
in
next2_cell_id_list
:
for
id_
in
next2_cell_id_list
:
self
.
assertFalse
(
catalog
.
hasPath
(
url
+
'/'
+
id_
))
self
.
assertFalse
(
catalog
.
hasPath
(
url
+
'/'
+
id_
))
...
@@ -259,7 +259,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -259,7 +259,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
# if we keep the same range, nothing happens
# if we keep the same range, nothing happens
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
self
.
assertEqual
(
len
(
matrix
.
getCellValueList
(
**
kwd
)),
2
)
self
.
assertEqual
(
len
(
matrix
.
getCellValueList
(
**
kwd
)),
2
)
self
.
tic
()
self
.
tic
()
...
@@ -271,7 +271,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -271,7 +271,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'0'
,
'2'
],
[
'a'
,
],
[
'Z'
]]
cell_range
=
[[
'0'
,
'2'
],
[
'a'
,
],
[
'Z'
]]
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
self
.
tic
()
self
.
tic
()
# in this case, cells has been removed
# in this case, cells has been removed
...
@@ -291,7 +291,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
...
@@ -291,7 +291,7 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
cell_range
=
[[
'1'
,
'2'
],
[
'a'
,
],
[
'X'
]]
cell_range
=
[[
'1'
,
'2'
],
[
'a'
,
],
[
'X'
]]
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
matrix
.
setCellRange
(
*
cell_range
,
**
kwd
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
)),
map
(
set
,
cell_range
))
self
.
assertEqual
(
list
(
map
(
set
,
matrix
.
getCellRange
(
**
kwd
))),
list
(
map
(
set
,
cell_range
)
))
self
.
tic
()
self
.
tic
()
# in this case, cells has been removed
# in this case, cells has been removed
...
...
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