Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
Matevz Golob
wendelin
Commits
bf2cdca7
Commit
bf2cdca7
authored
Aug 10, 2017
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs. Add test for bucket.
parent
3345371d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
4 deletions
+38
-4
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.py
...eItem/portal_components/document.erp5.DataBucketStream.py
+2
-1
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.xml
...Item/portal_components/document.erp5.DataBucketStream.xml
+2
-2
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+34
-1
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.py
View file @
bf2cdca7
...
@@ -35,7 +35,8 @@ from Products.ERP5Type.BTreeData import PersistentString
...
@@ -35,7 +35,8 @@ from Products.ERP5Type.BTreeData import PersistentString
class
DataBucketStream
(
Document
):
class
DataBucketStream
(
Document
):
"""
"""
Represents data stored in many small files.
Represents data stored in many small files inside a "stream".
Each file is "addressed" by its key similar to dict.
"""
"""
meta_type
=
'ERP5 Data Bucket Stream'
meta_type
=
'ERP5 Data Bucket Stream'
...
...
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.DataBucketStream.xml
View file @
bf2cdca7
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
W: 5
4
, 21: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W: 5
5
, 21: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W: 6
7
, 18: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W: 6
8
, 18: Redefining built-in \'id\' (redefined-builtin)
</string>
</tuple>
</tuple>
</value>
</value>
</item>
</item>
...
...
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
bf2cdca7
...
@@ -307,4 +307,37 @@ context.activate().DataStream_readChunkListAndTransform( \
...
@@ -307,4 +307,37 @@ context.activate().DataStream_readChunkListAndTransform( \
self
.
assertTrue
(
self
.
assertTrue
(
np
.
array_equal
(
data_array
.
getArraySlice
(
0
,
100
),
\
np
.
array_equal
(
data_array
.
getArraySlice
(
0
,
100
),
\
new_array
[:
100
]))
new_array
[:
100
]))
\ No newline at end of file
def
test_04_DataBucket
(
self
):
"""
Test data bucket
"""
bucket_stream
=
self
.
portal
.
data_stream_module
.
newContent
(
\
portal_type
=
'Data Bucket Stream'
)
self
.
tic
()
self
.
assertEqual
(
0
,
len
(
bucket_stream
))
# test set and get
bin_string
=
"1"
*
100000
key
=
len
(
bucket_stream
)
+
1
bucket_stream
.
insertBucket
(
key
,
bin_string
)
self
.
assertEqual
(
bin_string
,
bucket_stream
.
getBucket
(
key
))
# test sequence
self
.
assertEqual
(
1
,
len
(
bucket_stream
))
# test pop
bucket_stream
.
popBucket
(
key
)
self
.
assertEqual
(
0
,
len
(
bucket_stream
))
# set many buckets
for
i
in
range
(
100
):
bucket_stream
.
insertBucket
(
i
,
i
*
10000
)
self
.
assertEqual
(
100
,
len
(
bucket_stream
))
self
.
assertEqual
(
range
(
100
),
bucket_stream
.
getKeyList
())
# test as sequence
bucket
=
bucket_stream
.
getBucketItemSequence
(
start_key
=
10
,
count
=
1
)[
0
]
self
.
assertEqual
(
100000
,
bucket
[
1
].
value
)
\ No newline at end of file
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