Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
WindEnergyToolbox
Commits
c804ae2e
There was a problem fetching the pipeline summary.
Commit
c804ae2e
authored
9 years ago
by
mads
Browse files
Options
Downloads
Patches
Plain Diff
ci yml file
parent
e425daa0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+8
-0
8 additions, 0 deletions
.gitlab-ci.yml
wetb/gtsdf/tests/test_gtsdf.py
+29
-22
29 additions, 22 deletions
wetb/gtsdf/tests/test_gtsdf.py
with
37 additions
and
22 deletions
.gitlab-ci.yml
0 → 100644
+
8
−
0
View file @
c804ae2e
before_script
:
-
apt-get update
test-3.4
:
image
:
python:3.4
script
:
-
pip install -e .
-
py.test .
This diff is collapsed.
Click to expand it.
wetb/gtsdf/tests/test_gtsdf.py
+
29
−
22
View file @
c804ae2e
...
@@ -12,15 +12,20 @@ import unittest
...
@@ -12,15 +12,20 @@ import unittest
import
os
import
os
import
shutil
import
shutil
tmp_path
=
os
.
path
.
dirname
(
__file__
)
+
"
/tmp/
"
class
Test_gsdf
(
unittest
.
TestCase
):
class
Test_gsdf
(
unittest
.
TestCase
):
f
=
"
tmp/
"
def
setUp
(
self
):
def
setUp
(
self
):
unittest
.
TestCase
.
setUp
(
self
)
unittest
.
TestCase
.
setUp
(
self
)
if
not
os
.
path
.
isdir
(
self
.
f
):
if
not
os
.
path
.
isdir
(
tmp_path
):
os
.
makedirs
(
self
.
f
)
os
.
makedirs
(
tmp_path
)
@classmethod
def
tearDownClass
(
cls
):
super
(
Test_gsdf
,
cls
).
tearDownClass
()
shutil
.
rmtree
(
tmp_path
)
def
test_minimum_requirements
(
self
):
def
test_minimum_requirements
(
self
):
fn
=
self
.
f
+
"
minimum.hdf5
"
fn
=
tmp_path
+
"
minimum.hdf5
"
f
=
h5py
.
File
(
fn
,
"
w
"
)
f
=
h5py
.
File
(
fn
,
"
w
"
)
#no type
#no type
self
.
assertRaises
(
ValueError
,
gtsdf
.
load
,
fn
)
self
.
assertRaises
(
ValueError
,
gtsdf
.
load
,
fn
)
...
@@ -37,35 +42,37 @@ class Test_gsdf(unittest.TestCase):
...
@@ -37,35 +42,37 @@ class Test_gsdf(unittest.TestCase):
#no data
#no data
self
.
assertRaises
(
ValueError
,
gtsdf
.
load
,
fn
)
self
.
assertRaises
(
ValueError
,
gtsdf
.
load
,
fn
)
b
.
create_dataset
(
"
data
"
,
data
=
np
.
empty
((
0
,
0
)))
b
.
create_dataset
(
"
data
"
,
data
=
np
.
empty
((
0
,
0
)))
f
.
close
()
gtsdf
.
load
(
fn
)
gtsdf
.
load
(
fn
)
def
test_save_no_hdf5_ext
(
self
):
def
test_save_no_hdf5_ext
(
self
):
fn
=
self
.
f
+
"
no_hdf5_ext
"
fn
=
tmp_path
+
"
no_hdf5_ext
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
_
,
_
,
info
=
gtsdf
.
load
(
fn
+
"
.hdf5
"
)
_
,
_
,
info
=
gtsdf
.
load
(
fn
+
"
.hdf5
"
)
self
.
assertEqual
(
info
[
'
name
'
],
'
no_hdf5_ext
'
)
self
.
assertEqual
(
info
[
'
name
'
],
'
no_hdf5_ext
'
)
def
test_load_filename
(
self
):
def
test_load_filename
(
self
):
fn
=
self
.
f
+
"
filename.hdf5
"
fn
=
tmp_path
+
"
filename.hdf5
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
_
,
_
,
info
=
gtsdf
.
load
(
fn
)
_
,
_
,
info
=
gtsdf
.
load
(
fn
)
self
.
assertEqual
(
info
[
'
name
'
],
'
filename
'
)
self
.
assertEqual
(
info
[
'
name
'
],
'
filename
'
)
def
test_load_fileobject
(
self
):
def
test_load_fileobject
(
self
):
fn
=
self
.
f
+
"
fileobject.hdf5
"
fn
=
tmp_path
+
"
fileobject.hdf5
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
))
_
,
_
,
info
=
gtsdf
.
load
(
fn
)
_
,
_
,
info
=
gtsdf
.
load
(
fn
)
self
.
assertEqual
(
info
[
'
name
'
],
'
fileobject
'
)
self
.
assertEqual
(
info
[
'
name
'
],
'
fileobject
'
)
def
test_save_wrong_no_attr_info
(
self
):
def
test_save_wrong_no_attr_info
(
self
):
fn
=
self
.
f
+
"
wrong_no_attr_info.hdf5
"
fn
=
tmp_path
+
"
wrong_no_attr_info.hdf5
"
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_names
=
[
'
Att1
'
])
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_names
=
[
'
Att1
'
])
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_units
=
[
'
s
'
])
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_units
=
[
'
s
'
])
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_descriptions
=
[
'
desc
'
])
self
.
assertRaises
(
AssertionError
,
gtsdf
.
save
,
fn
,
np
.
arange
(
12
).
reshape
(
4
,
3
),
attribute_descriptions
=
[
'
desc
'
])
def
test_info
(
self
):
def
test_info
(
self
):
fn
=
self
.
f
+
"
info.hdf5
"
fn
=
tmp_path
+
"
info.hdf5
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
name
=
'
datasetname
'
,
name
=
'
datasetname
'
,
description
=
'
datasetdescription
'
,
description
=
'
datasetdescription
'
,
...
@@ -81,39 +88,39 @@ class Test_gsdf(unittest.TestCase):
...
@@ -81,39 +88,39 @@ class Test_gsdf(unittest.TestCase):
self
.
assertEqual
(
list
(
info
[
'
attribute_descriptions
'
]),
[
'
d1
'
,
'
d2
'
])
self
.
assertEqual
(
list
(
info
[
'
attribute_descriptions
'
]),
[
'
d1
'
,
'
d2
'
])
def
test_no_time
(
self
):
def
test_no_time
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
))
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
6
))
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
6
))
def
test_int_time
(
self
):
def
test_int_time
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
4
,
10
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
4
,
10
))
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
np
.
testing
.
assert_array_equal
(
time
,
range
(
4
,
10
))
np
.
testing
.
assert_array_equal
(
time
,
range
(
4
,
10
))
def
test_time_offset
(
self
):
def
test_time_offset
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
6
),
time_start
=
4
)
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
6
),
time_start
=
4
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
np
.
testing
.
assert_array_equal
(
time
,
range
(
4
,
10
))
np
.
testing
.
assert_array_equal
(
time
,
range
(
4
,
10
))
def
test_time_gain_offset
(
self
):
def
test_time_gain_offset
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
)
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
4
,
5.5
,
.
25
))
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
4
,
5.5
,
.
25
))
def
test_float_time
(
self
):
def
test_float_time
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
np
.
arange
(
4
,
5.5
,
.
25
))
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
time
=
np
.
arange
(
4
,
5.5
,
.
25
))
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
time
,
_
,
_
=
gtsdf
.
load
(
fn
)
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
4
,
5.5
,
.
25
))
np
.
testing
.
assert_array_equal
(
time
,
np
.
arange
(
4
,
5.5
,
.
25
))
def
test_data
(
self
):
def
test_data
(
self
):
fn
=
self
.
f
+
'
data.hdf5
'
fn
=
tmp_path
+
'
data.hdf5
'
d
=
np
.
arange
(
12
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
).
reshape
(
6
,
2
)
gtsdf
.
save
(
fn
,
d
)
gtsdf
.
save
(
fn
,
d
)
f
=
h5py
.
File
(
fn
)
f
=
h5py
.
File
(
fn
)
...
@@ -123,7 +130,7 @@ class Test_gsdf(unittest.TestCase):
...
@@ -123,7 +130,7 @@ class Test_gsdf(unittest.TestCase):
np
.
testing
.
assert_array_almost_equal
(
data
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
4
)
np
.
testing
.
assert_array_almost_equal
(
data
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
4
)
def
test_data_float
(
self
):
def
test_data_float
(
self
):
fn
=
self
.
f
+
'
time.hdf5
'
fn
=
tmp_path
+
'
time.hdf5
'
d
=
np
.
arange
(
12
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
).
reshape
(
6
,
2
)
gtsdf
.
save
(
fn
,
d
,
dtype
=
np
.
float32
)
gtsdf
.
save
(
fn
,
d
,
dtype
=
np
.
float32
)
f
=
h5py
.
File
(
fn
)
f
=
h5py
.
File
(
fn
)
...
@@ -134,7 +141,7 @@ class Test_gsdf(unittest.TestCase):
...
@@ -134,7 +141,7 @@ class Test_gsdf(unittest.TestCase):
def
test_all
(
self
):
def
test_all
(
self
):
fn
=
self
.
f
+
"
all.hdf5
"
fn
=
tmp_path
+
"
all.hdf5
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
name
=
'
datasetname
'
,
name
=
'
datasetname
'
,
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
,
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
,
...
@@ -153,7 +160,7 @@ class Test_gsdf(unittest.TestCase):
...
@@ -153,7 +160,7 @@ class Test_gsdf(unittest.TestCase):
np
.
testing
.
assert_array_almost_equal
(
data
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
4
)
np
.
testing
.
assert_array_almost_equal
(
data
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
4
)
def
test_append
(
self
):
def
test_append
(
self
):
fn
=
self
.
f
+
'
append.hdf5
'
fn
=
tmp_path
+
'
append.hdf5
'
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
[
2
,
0
]
=
np
.
nan
d
[
2
,
0
]
=
np
.
nan
gtsdf
.
save
(
fn
,
d
)
gtsdf
.
save
(
fn
,
d
)
...
@@ -166,7 +173,7 @@ class Test_gsdf(unittest.TestCase):
...
@@ -166,7 +173,7 @@ class Test_gsdf(unittest.TestCase):
def
test_nan_float
(
self
):
def
test_nan_float
(
self
):
fn
=
self
.
f
+
'
nan.hdf5
'
fn
=
tmp_path
+
'
nan.hdf5
'
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
[
2
,
0
]
=
np
.
nan
d
[
2
,
0
]
=
np
.
nan
gtsdf
.
save
(
fn
,
d
)
gtsdf
.
save
(
fn
,
d
)
...
@@ -176,7 +183,7 @@ class Test_gsdf(unittest.TestCase):
...
@@ -176,7 +183,7 @@ class Test_gsdf(unittest.TestCase):
def
test_outlier
(
self
):
def
test_outlier
(
self
):
fn
=
self
.
f
+
'
outlier.hdf5
'
fn
=
tmp_path
+
'
outlier.hdf5
'
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
[
2
,
0
]
=
10
**
4
d
[
2
,
0
]
=
10
**
4
d
[
3
,
1
]
=
10
**
4
d
[
3
,
1
]
=
10
**
4
...
@@ -184,14 +191,14 @@ class Test_gsdf(unittest.TestCase):
...
@@ -184,14 +191,14 @@ class Test_gsdf(unittest.TestCase):
_
,
data
,
_
=
gtsdf
.
load
(
fn
)
_
,
data
,
_
=
gtsdf
.
load
(
fn
)
def
test_inf
(
self
):
def
test_inf
(
self
):
fn
=
self
.
f
+
'
outlier.hdf5
'
fn
=
tmp_path
+
'
outlier.hdf5
'
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
=
np
.
arange
(
12
,
dtype
=
np
.
float32
).
reshape
(
6
,
2
)
d
[
2
,
0
]
=
np
.
inf
d
[
2
,
0
]
=
np
.
inf
d
[
3
,
1
]
=
10
**
3
d
[
3
,
1
]
=
10
**
3
self
.
assertRaises
(
ValueError
,
gtsdf
.
save
,
fn
,
d
)
self
.
assertRaises
(
ValueError
,
gtsdf
.
save
,
fn
,
d
)
def
test_loadpandas
(
self
):
def
test_loadpandas
(
self
):
fn
=
self
.
f
+
"
all.hdf5
"
fn
=
tmp_path
+
"
all.hdf5
"
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
gtsdf
.
save
(
fn
,
np
.
arange
(
12
).
reshape
(
6
,
2
),
name
=
'
datasetname
'
,
name
=
'
datasetname
'
,
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
,
time
=
range
(
6
),
time_step
=
1
/
4
,
time_start
=
4
,
...
...
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