Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
postpic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LabAstro
postpic
Commits
32fce875
Commit
32fce875
authored
Dec 12, 2017
by
Alexander Blinne
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests
parent
fa3f24aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
run-tests.py
+1
-1
1 addition, 1 deletion
run-tests.py
test/test_datahandling.py
+18
-12
18 additions, 12 deletions
test/test_datahandling.py
with
19 additions
and
13 deletions
run-tests.py
+
1
−
1
View file @
32fce875
...
@@ -78,7 +78,7 @@ def run_alltests(python='python', fast=False):
...
@@ -78,7 +78,7 @@ def run_alltests(python='python', fast=False):
if
not
pycodestylecmd
:
if
not
pycodestylecmd
:
raise
ImportError
(
'
Install pep8 or pycodestyle (its successor)
'
)
raise
ImportError
(
'
Install pep8 or pycodestyle (its successor)
'
)
cmds
=
[
python
+
'
-m nose
'
,
cmds
=
[
python
+
'
-m nose
--exe
'
,
python
+
'
-m
'
+
pycodestylecmd
+
'
postpic --statistics --count --show-source
'
python
+
'
-m
'
+
pycodestylecmd
+
'
postpic --statistics --count --show-source
'
'
--ignore=W391,E123,E226,E24 --max-line-length=99
'
]
'
--ignore=W391,E123,E226,E24 --max-line-length=99
'
]
cmdo
=
[
python
+
'
setup.py build_sphinx
'
,
cmdo
=
[
python
+
'
setup.py build_sphinx
'
,
...
...
This diff is collapsed.
Click to expand it.
test/test_datahandling.py
+
18
−
12
View file @
32fce875
...
@@ -74,12 +74,12 @@ class TestField(unittest.TestCase):
...
@@ -74,12 +74,12 @@ class TestField(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
fempty
=
dh
.
Field
([])
self
.
fempty
=
dh
.
Field
([])
self
.
f0d
=
dh
.
Field
([
42
])
self
.
f0d
=
dh
.
Field
([
42
.
])
m
=
np
.
reshape
(
np
.
arange
(
10
),
10
)
m
=
np
.
reshape
(
np
.
arange
(
10
)
.
astype
(
'
d
'
)
,
10
)
self
.
f1d
=
dh
.
Field
(
m
)
self
.
f1d
=
dh
.
Field
(
m
)
m
=
np
.
reshape
(
np
.
arange
(
20
),
(
4
,
5
))
m
=
np
.
reshape
(
np
.
arange
(
20
)
.
astype
(
'
d
'
)
,
(
4
,
5
))
self
.
f2d
=
dh
.
Field
(
m
)
self
.
f2d
=
dh
.
Field
(
m
)
m
=
np
.
reshape
(
np
.
arange
(
60
),
(
4
,
5
,
3
))
m
=
np
.
reshape
(
np
.
arange
(
60
)
.
astype
(
'
d
'
)
,
(
4
,
5
,
3
))
self
.
f3d
=
dh
.
Field
(
m
)
self
.
f3d
=
dh
.
Field
(
m
)
x
,
y
=
helper
.
meshgrid
(
np
.
linspace
(
0
,
2
*
np
.
pi
,
100
),
np
.
linspace
(
0
,
2
*
np
.
pi
,
100
),
indexing
=
'
ij
'
,
sparse
=
True
)
x
,
y
=
helper
.
meshgrid
(
np
.
linspace
(
0
,
2
*
np
.
pi
,
100
),
np
.
linspace
(
0
,
2
*
np
.
pi
,
100
),
indexing
=
'
ij
'
,
sparse
=
True
)
...
@@ -140,20 +140,26 @@ class TestField(unittest.TestCase):
...
@@ -140,20 +140,26 @@ class TestField(unittest.TestCase):
self
.
checkFieldConsistancy
(
f
)
self
.
checkFieldConsistancy
(
f
)
def
test_slicing
(
self
):
def
test_slicing
(
self
):
self
.
assertEqual
(
self
.
f1d
[
0.15
:
0.75
].
matrix
.
shape
,
(
6
,))
self
.
assertEqual
(
self
.
f1d
[
0.15
:
0.75
].
shape
,
(
6
,))
self
.
assertEqual
(
self
.
f1d
[
5
].
matrix
.
shape
,
(
1
,))
self
.
assertEqual
(
self
.
f1d
[
5
].
shape
,
(
1
,))
self
.
assertEqual
(
self
.
f2d
[
0.5
:,
:].
matrix
.
shape
,
(
2
,
5
))
self
.
assertEqual
(
self
.
f2d
[
0.5
:,
:].
shape
,
(
2
,
5
))
self
.
assertEqual
(
self
.
f3d
[
0.5
:,
:,
0.5
].
matrix
.
shape
,
(
2
,
5
,
1
))
self
.
assertEqual
(
self
.
f3d
[
0.5
:,
:,
0.5
].
shape
,
(
2
,
5
,
1
))
def
test_cutout
(
self
):
self
.
assertEqual
(
self
.
f1d
.
cutout
((
0.15
,
0.75
)).
shape
,
(
6
,))
self
.
assertEqual
(
self
.
f3d
.
cutout
((
None
,
None
,
None
,
None
,
None
,
None
)).
shape
,
self
.
f3d
.
shape
)
self
.
assertEqual
(
self
.
f3d
.
cutout
((
0.874
,
None
,
None
,
None
,
None
,
None
)).
shape
,
(
1
,
5
,
3
))
self
.
assertEqual
(
self
.
f3d
.
cutout
((
0.874
,
None
,
None
,
None
,
None
,
None
)).
squeeze
().
shape
,
(
5
,
3
))
def
test_squeeze
(
self
):
def
test_squeeze
(
self
):
s
=
self
.
f3d
[
0.5
:,
:,
0.5
].
squeeze
().
shape
s
=
self
.
f3d
[
0.5
:,
:,
0.5
].
squeeze
().
shape
self
.
assertEqual
(
s
,
(
2
,
5
))
self
.
assertEqual
(
s
,
(
2
,
5
))
s
=
self
.
f3d
[
1.5
:
2
,
:,
:].
squeeze
().
shape
s
=
self
.
f3d
[
0.874
:
2
.
,
:,
:].
squeeze
().
shape
self
.
assertEqual
(
s
,
(
0
,
5
,
3
))
self
.
assertEqual
(
s
,
(
5
,
3
))
s
=
self
.
f3d
[
1.5
:
2
,
0.3
,
:].
squeeze
().
shape
s
=
self
.
f3d
[
0.874
:
2
,
0.3
,
:].
squeeze
().
shape
self
.
assertEqual
(
s
,
(
0
,
3
))
self
.
assertEqual
(
s
,
(
3
,
))
def
test_transpose
(
self
):
def
test_transpose
(
self
):
f3d_T
=
self
.
f3d
.
T
f3d_T
=
self
.
f3d
.
T
...
...
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