Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
catalog
Tools
Merge requests
!2
draft: Basic dataset
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
draft: Basic dataset
basic_dataset
into
main
Overview
0
Commits
7
Pipelines
8
Changes
8
Open
Florian Ziemen
requested to merge
basic_dataset
into
main
1 year ago
Overview
0
Commits
7
Pipelines
8
Changes
8
Expand
0
0
Merge request reports
Compare
main
version 7
64324127
1 year ago
version 6
c5f8b2e7
1 year ago
version 5
56fece57
1 year ago
version 4
3fcd8897
1 year ago
version 3
68af4ce1
1 year ago
version 2
6e7879c7
1 year ago
version 1
13425e4e
1 year ago
main (HEAD)
and
latest version
latest version
1f32375e
7 commits,
1 year ago
version 7
64324127
7 commits,
1 year ago
version 6
c5f8b2e7
7 commits,
1 year ago
version 5
56fece57
7 commits,
1 year ago
version 4
3fcd8897
5 commits,
1 year ago
version 3
68af4ce1
4 commits,
1 year ago
version 2
6e7879c7
3 commits,
1 year ago
version 1
13425e4e
2 commits,
1 year ago
8 files
+
231
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
unit_tests/test_dataset.py
0 → 100644
+
59
−
0
Options
import
dataset
import
unittest
from
serde.yaml
import
from_yaml
,
to_yaml
class
test_dataset
(
unittest
.
TestCase
):
dsl1
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
"
local
"
,
path
=
"
/scratch/
"
)
dsl2
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
"
local
"
,
path
=
"
/work/
"
)
ds
=
dataset
.
dataset
(
name
=
"
test_ds
"
,
serve
=
True
,
locations
=
(
dsl1
,
dsl2
))
def
test_dataset
(
self
):
dsl1
=
test_dataset
.
dsl1
ds
=
dataset
.
dataset
(
name
=
"
test_ds
"
,
serve
=
True
,
locations
=
(
dsl1
,))
self
.
assertTrue
(
ds
.
is_valid
())
ds
=
test_dataset
.
ds
self
.
assertTrue
(
ds
.
is_valid
())
def
test_bad_dataset_location
(
self
):
badhost
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
None
,
path
=
"
/scratch/
"
)
self
.
assertFalse
(
badhost
.
is_valid
())
badpath
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
"
local
"
,
path
=
None
)
self
.
assertFalse
(
badpath
.
is_valid
())
badmethod
=
dataset
.
dataset_location
(
method
=
None
,
host
=
"
local
"
,
path
=
"
/scratch
"
)
self
.
assertFalse
(
badmethod
.
is_valid
())
def
test_bad_dataset
(
self
):
dsl1
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
"
local
"
,
path
=
"
/scratch/
"
)
bad_name
=
dataset
.
dataset
(
name
=
None
,
serve
=
True
,
locations
=
(
dsl1
,))
self
.
assertFalse
(
bad_name
.
is_valid
())
bad_serve
=
dataset
.
dataset
(
name
=
"
test
"
,
serve
=
7
,
locations
=
(
dsl1
,))
self
.
assertFalse
(
bad_serve
.
is_valid
())
with
self
.
assertRaises
(
TypeError
):
bad_location
=
dataset
.
dataset
(
name
=
None
,
serve
=
True
,
locations
=
dsl1
)
badpath
=
dataset
.
dataset_location
(
method
=
"
direct
"
,
host
=
"
local
"
,
path
=
None
)
bad_location
=
dataset
.
dataset
(
name
=
None
,
serve
=
True
,
locations
=
(
badpath
,))
self
.
assertFalse
(
bad_location
.
is_valid
())
with
self
.
assertRaises
(
TypeError
):
bad_location
=
dataset
.
dataset
(
name
=
None
,
serve
=
True
,
locations
=
(
None
,))
def
test_to_from_yaml
(
self
):
ds
=
test_dataset
.
ds
with
open
(
"
test.yaml
"
,
"
w
"
)
as
of
:
of
.
write
(
to_yaml
(
ds
))
with
open
(
"
test.yaml
"
,
"
r
"
)
as
infile
:
obj
=
from_yaml
(
dataset
.
dataset
,
infile
.
read
())
self
.
assertEqual
(
obj
,
ds
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
Loading