Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
esde
machine-learning
MLAir
Commits
43cc0763
Commit
43cc0763
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
refac tests
parent
d0070606
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!50
release for v0.7.0
Pipeline
#31034
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_datastore.py
+38
-16
38 additions, 16 deletions
test/test_datastore.py
test/test_modules/test_pre_processing.py
+0
-10
0 additions, 10 deletions
test/test_modules/test_pre_processing.py
with
38 additions
and
26 deletions
test/test_datastore.py
+
38
−
16
View file @
43cc0763
...
@@ -30,6 +30,14 @@ class TestDataStoreByVariable:
...
@@ -30,6 +30,14 @@ class TestDataStoreByVariable:
def
ds
(
self
):
def
ds
(
self
):
return
DataStoreByVariable
()
return
DataStoreByVariable
()
@pytest.fixture
def
ds_with_content
(
self
,
ds
):
ds
.
set
(
"
tester1
"
,
1
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
11
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
10
,
"
general.sub
"
)
ds
.
set
(
"
tester3
"
,
21
,
"
general
"
)
return
ds
def
test_put
(
self
,
ds
):
def
test_put
(
self
,
ds
):
ds
.
set
(
"
number
"
,
3
,
"
general.subscope
"
)
ds
.
set
(
"
number
"
,
3
,
"
general.subscope
"
)
assert
ds
.
_store
[
"
number
"
][
"
general.subscope
"
]
==
3
assert
ds
.
_store
[
"
number
"
][
"
general.subscope
"
]
==
3
...
@@ -131,15 +139,18 @@ class TestDataStoreByVariable:
...
@@ -131,15 +139,18 @@ class TestDataStoreByVariable:
assert
ds
.
search_scope
(
"
general.sub.sub
"
,
current_scope_only
=
False
,
return_all
=
True
)
==
\
assert
ds
.
search_scope
(
"
general.sub.sub
"
,
current_scope_only
=
False
,
return_all
=
True
)
==
\
[(
"
number
"
,
"
general.sub.sub
"
,
"
ABC
"
),
(
"
number1
"
,
"
general.sub
"
,
22
),
(
"
number2
"
,
"
general.sub.sub
"
,
3
)]
[(
"
number
"
,
"
general.sub.sub
"
,
"
ABC
"
),
(
"
number1
"
,
"
general.sub
"
,
22
),
(
"
number2
"
,
"
general.sub.sub
"
,
3
)]
def
test_create_args_dict
(
self
,
ds
):
def
test_create_args_dict_default_scope
(
self
,
ds_with_content
):
ds
.
set
(
"
tester1
"
,
1
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
11
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
10
,
"
general.sub
"
)
ds
.
set
(
"
tester3
"
,
21
,
"
general
"
)
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
assert
ds
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
11
,
"
tester3
"
:
21
}
assert
ds_with_content
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
11
,
"
tester3
"
:
21
}
assert
ds
.
create_args_dict
(
args
,
"
general.sub
"
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
}
assert
ds
.
create_args_dict
([
"
notAvail
"
,
"
alsonot
"
])
==
{}
def
test_create_args_dict_given_scope
(
self
,
ds_with_content
):
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
assert
ds_with_content
.
create_args_dict
(
args
,
"
general.sub
"
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
}
def
test_create_args_dict_missing_entry
(
self
,
ds_with_content
):
args
=
[
"
tester1
"
,
"
notAvail
"
,
"
tester4
"
]
assert
ds_with_content
.
create_args_dict
([
"
notAvail
"
,
"
alsonot
"
])
==
{}
assert
ds_with_content
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
}
def
test_set_args_from_dict
(
self
,
ds
):
def
test_set_args_from_dict
(
self
,
ds
):
ds
.
set_args_from_dict
({
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
})
ds
.
set_args_from_dict
({
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
})
...
@@ -157,6 +168,14 @@ class TestDataStoreByScope:
...
@@ -157,6 +168,14 @@ class TestDataStoreByScope:
def
ds
(
self
):
def
ds
(
self
):
return
DataStoreByScope
()
return
DataStoreByScope
()
@pytest.fixture
def
ds_with_content
(
self
,
ds
):
ds
.
set
(
"
tester1
"
,
1
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
11
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
10
,
"
general.sub
"
)
ds
.
set
(
"
tester3
"
,
21
,
"
general
"
)
return
ds
def
test_put_with_scope
(
self
,
ds
):
def
test_put_with_scope
(
self
,
ds
):
ds
.
set
(
"
number
"
,
3
,
"
general.subscope
"
)
ds
.
set
(
"
number
"
,
3
,
"
general.subscope
"
)
assert
ds
.
_store
[
"
general.subscope
"
][
"
number
"
]
==
3
assert
ds
.
_store
[
"
general.subscope
"
][
"
number
"
]
==
3
...
@@ -258,15 +277,18 @@ class TestDataStoreByScope:
...
@@ -258,15 +277,18 @@ class TestDataStoreByScope:
assert
ds
.
search_scope
(
"
general.sub.sub
"
,
current_scope_only
=
False
,
return_all
=
True
)
==
\
assert
ds
.
search_scope
(
"
general.sub.sub
"
,
current_scope_only
=
False
,
return_all
=
True
)
==
\
[(
"
number
"
,
"
general.sub.sub
"
,
"
ABC
"
),
(
"
number1
"
,
"
general.sub
"
,
22
),
(
"
number2
"
,
"
general.sub.sub
"
,
3
)]
[(
"
number
"
,
"
general.sub.sub
"
,
"
ABC
"
),
(
"
number1
"
,
"
general.sub
"
,
22
),
(
"
number2
"
,
"
general.sub.sub
"
,
3
)]
def
test_create_args_dict
(
self
,
ds
):
def
test_create_args_dict_default_scope
(
self
,
ds_with_content
):
ds
.
set
(
"
tester1
"
,
1
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
11
,
"
general
"
)
ds
.
set
(
"
tester2
"
,
10
,
"
general.sub
"
)
ds
.
set
(
"
tester3
"
,
21
,
"
general
"
)
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
assert
ds
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
11
,
"
tester3
"
:
21
}
assert
ds_with_content
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
11
,
"
tester3
"
:
21
}
assert
ds
.
create_args_dict
(
args
,
"
general.sub
"
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
}
assert
ds
.
create_args_dict
([
"
notAvail
"
,
"
alsonot
"
])
==
{}
def
test_create_args_dict_given_scope
(
self
,
ds_with_content
):
args
=
[
"
tester1
"
,
"
tester2
"
,
"
tester3
"
,
"
tester4
"
]
assert
ds_with_content
.
create_args_dict
(
args
,
"
general.sub
"
)
==
{
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
}
def
test_create_args_dict_missing_entry
(
self
,
ds_with_content
):
args
=
[
"
tester1
"
,
"
notAvail
"
,
"
tester4
"
]
assert
ds_with_content
.
create_args_dict
([
"
notAvail
"
,
"
alsonot
"
])
==
{}
assert
ds_with_content
.
create_args_dict
(
args
)
==
{
"
tester1
"
:
1
}
def
test_set_args_from_dict
(
self
,
ds
):
def
test_set_args_from_dict
(
self
,
ds
):
ds
.
set_args_from_dict
({
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
})
ds
.
set_args_from_dict
({
"
tester1
"
:
1
,
"
tester2
"
:
10
,
"
tester3
"
:
21
})
...
...
This diff is collapsed.
Click to expand it.
test/test_modules/test_pre_processing.py
+
0
−
10
View file @
43cc0763
...
@@ -101,13 +101,3 @@ class TestPreProcessing:
...
@@ -101,13 +101,3 @@ class TestPreProcessing:
assert
dummy_list
[
val
]
==
list
(
range
(
10
,
13
))
assert
dummy_list
[
val
]
==
list
(
range
(
10
,
13
))
assert
dummy_list
[
test
]
==
list
(
range
(
13
,
15
))
assert
dummy_list
[
test
]
==
list
(
range
(
13
,
15
))
assert
dummy_list
[
train_val
]
==
list
(
range
(
0
,
13
))
assert
dummy_list
[
train_val
]
==
list
(
range
(
0
,
13
))
def
test_create_args_dict_default_scope
(
self
,
obj_super_init
):
assert
obj_super_init
.
data_store
.
create_args_dict
([
"
NAME1
"
,
"
NAME2
"
])
==
{
"
NAME1
"
:
1
,
"
NAME2
"
:
2
}
def
test_create_args_dict_given_scope
(
self
,
obj_super_init
):
assert
obj_super_init
.
data_store
.
create_args_dict
([
"
NAME1
"
,
"
NAME2
"
],
scope
=
"
general.sub
"
)
==
{
"
NAME1
"
:
10
,
"
NAME2
"
:
2
}
def
test_create_args_dict_missing_entry
(
self
,
obj_super_init
):
assert
obj_super_init
.
data_store
.
create_args_dict
([
"
NAME5
"
,
"
NAME2
"
])
==
{
"
NAME2
"
:
2
}
assert
obj_super_init
.
data_store
.
create_args_dict
([
"
NAME4
"
,
"
NAME2
"
])
==
{
"
NAME2
"
:
2
}
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