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
67fd7414
Commit
67fd7414
authored
Jun 24, 2015
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend test.
parent
8fcca25e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
bt5/erp5_wendelin/ExtensionTemplateItem/portal_components/extension.erp5.Wendelin.py
...TemplateItem/portal_components/extension.erp5.Wendelin.py
+4
-4
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+15
-7
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.xml
...TemplateItem/portal_components/test.erp5.testWendelin.xml
+4
-4
No files found.
bt5/erp5_wendelin/ExtensionTemplateItem/portal_components/extension.erp5.Wendelin.py
View file @
67fd7414
...
@@ -11,14 +11,15 @@ def DataStream_copyCSVToDataArray(self, chunk_list, start, end, \
...
@@ -11,14 +11,15 @@ def DataStream_copyCSVToDataArray(self, chunk_list, start, end, \
Receive CSV data and transform it to a numpy array of floats.
Receive CSV data and transform it to a numpy array of floats.
"""
"""
chunk_text
=
''
.
join
(
chunk_list
)
chunk_text
=
''
.
join
(
chunk_list
)
# compensate possible offset mistmatch
# compensate possible offset mistmatch
last_new_line_index
=
chunk_text
.
rfind
(
'
\
n
'
)
last_new_line_index
=
chunk_text
.
rfind
(
'
\
n
'
)
offset_mismatch
=
len
(
chunk_text
)
-
last_new_line_index
-
1
offset_mismatch
=
len
(
chunk_text
)
-
last_new_line_index
-
1
start
=
start
-
offset_mismatch
start
=
start
-
offset_mismatch
end
=
end
-
offset_mismatch
end
=
end
-
offset_mismatch
#self.log('%s %s %s' %(len(chunk_list), chunk_text.rfind('\n'), chunk_list))
#self.log(chunk_text)
# remove offset line which is to be processed next call
# remove offset line which is to be processed next call
chunk_text
=
chunk_text
[:
len
(
chunk_text
)
-
offset_mismatch
-
1
]
chunk_text
=
chunk_text
[:
len
(
chunk_text
)
-
offset_mismatch
-
1
]
...
@@ -29,9 +30,8 @@ def DataStream_copyCSVToDataArray(self, chunk_list, start, end, \
...
@@ -29,9 +30,8 @@ def DataStream_copyCSVToDataArray(self, chunk_list, start, end, \
line_item_list
=
line
.
split
(
','
)
line_item_list
=
line
.
split
(
','
)
size_list
.
extend
([
x
for
x
in
line_item_list
])
size_list
.
extend
([
x
for
x
in
line_item_list
])
self
.
log
(
size_list
)
# save this value as a numpy array (for testing, only create ZBigArray for one variable)
# save this value as a numpy array (for testing, only create ZBigArray for one variable)
#self.log(size_list)
size_list
=
[
float
(
x
)
for
x
in
size_list
]
size_list
=
[
float
(
x
)
for
x
in
size_list
]
ndarray
=
np
.
array
(
size_list
)
ndarray
=
np
.
array
(
size_list
)
...
...
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
67fd7414
...
@@ -35,6 +35,11 @@ import random
...
@@ -35,6 +35,11 @@ import random
def
getRandomString
():
def
getRandomString
():
return
'test_%s'
%
''
.
join
([
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
\
return
'test_%s'
%
''
.
join
([
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
\
for
n
in
xrange
(
32
)])
for
n
in
xrange
(
32
)])
def
chunks
(
l
,
n
):
"""Yield successive n-sized chunks from l."""
for
i
in
xrange
(
0
,
len
(
l
),
n
):
yield
l
[
i
:
i
+
n
]
class
Test
(
ERP5TypeTestCase
):
class
Test
(
ERP5TypeTestCase
):
"""
"""
...
@@ -69,10 +74,10 @@ class Test(ERP5TypeTestCase):
...
@@ -69,10 +74,10 @@ class Test(ERP5TypeTestCase):
portal
=
self
.
portal
portal
=
self
.
portal
request
=
portal
.
REQUEST
request
=
portal
.
REQUEST
# simulate fluentd by setting proper values in REQUEST
reference
=
getRandomString
()
reference
=
getRandomString
()
number_string
=
','
.
join
([
str
(
x
)
for
x
in
range
(
11
)])
number_string_list
=
[]
number_string_list
=
[
number_string
]
*
10000
for
my_list
in
list
(
chunks
(
range
(
0
,
100001
),
10
)):
number_string_list
.
append
(
','
.
join
([
str
(
x
)
for
x
in
my_list
]))
real_data
=
'
\
n
'
.
join
(
number_string_list
)
real_data
=
'
\
n
'
.
join
(
number_string_list
)
# create ingestion policy
# create ingestion policy
...
@@ -109,7 +114,7 @@ class Test(ERP5TypeTestCase):
...
@@ -109,7 +114,7 @@ class Test(ERP5TypeTestCase):
data_supply_line_kw
)
data_supply_line_kw
)
self
.
tic
()
self
.
tic
()
#
do real ingestion call
#
simulate fluentd by setting proper values in REQUEST
request
.
method
=
'POST'
request
.
method
=
'POST'
data_chunk
=
msgpack
.
packb
([
0
,
real_data
],
use_bin_type
=
True
)
data_chunk
=
msgpack
.
packb
([
0
,
real_data
],
use_bin_type
=
True
)
request
.
set
(
'reference'
,
reference
)
request
.
set
(
'reference'
,
reference
)
...
@@ -131,7 +136,7 @@ class Test(ERP5TypeTestCase):
...
@@ -131,7 +136,7 @@ class Test(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
data_stream
.
DataStream_transform
(
\
data_stream
.
DataStream_transform
(
\
chunk_length
=
52001
,
\
chunk_length
=
10450
,
\
transform_script_id
=
'DataStream_copyCSVToDataArray'
,
transform_script_id
=
'DataStream_copyCSVToDataArray'
,
data_array_reference
=
reference
)
data_array_reference
=
reference
)
...
@@ -141,9 +146,12 @@ class Test(ERP5TypeTestCase):
...
@@ -141,9 +146,12 @@ class Test(ERP5TypeTestCase):
zarray
=
data_array
.
getArray
()
zarray
=
data_array
.
getArray
()
np
.
average
(
zarray
)
np
.
average
(
zarray
)
#
XXX: test that extracted array is same as input one
#
test that extracted array contains same values as input CSV
self
.
assertNotEqual
(
None
,
zarray
)
self
.
assertNotEqual
(
None
,
zarray
)
#self.assertEqual(1, zarray.shape)
self
.
assertEqual
(
99999.0
,
np
.
amax
(
zarray
,
axis
=
0
))
self
.
assertEqual
(
0.0
,
np
.
amin
(
zarray
,
axis
=
0
))
# failing in array shape, not investigated why
self
.
assertEqual
((
99999
,),
zarray
.
shape
)
def
test_02_Examples
(
self
):
def
test_02_Examples
(
self
):
"""
"""
...
...
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.xml
View file @
67fd7414
...
@@ -47,10 +47,10 @@
...
@@ -47,10 +47,10 @@
<value>
<value>
<tuple>
<tuple>
<string>
W: 37, 8: Unused variable \'n\' (unused-variable)
</string>
<string>
W: 37, 8: Unused variable \'n\' (unused-variable)
</string>
<string>
W:
59
, 4: Unused variable \'scipy\' (unused-variable)
</string>
<string>
W:
64
, 4: Unused variable \'scipy\' (unused-variable)
</string>
<string>
W: 6
1
, 4: Unused variable \'pandas\' (unused-variable)
</string>
<string>
W: 6
6
, 4: Unused variable \'pandas\' (unused-variable)
</string>
<string>
W: 6
0
, 4: Unused variable \'sklearn\' (unused-variable)
</string>
<string>
W: 6
5
, 4: Unused variable \'sklearn\' (unused-variable)
</string>
<string>
W:1
07
, 4: Unused variable \'data_supply\' (unused-variable)
</string>
<string>
W:1
12
, 4: Unused variable \'data_supply\' (unused-variable)
</string>
</tuple>
</tuple>
</value>
</value>
</item>
</item>
...
...
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