Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
AKPlanning
Commits
0e9d0faf
Commit
0e9d0faf
authored
4 months ago
by
Felix Blanke
Browse files
Options
Downloads
Patches
Plain Diff
Remove tests covered by schema
parent
3c7873e5
No related branches found
No related tags found
1 merge request
!268
Merge fork for interoperability of KoMa solver
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/tests/test_json_export.py
+15
-180
15 additions, 180 deletions
AKModel/tests/test_json_export.py
with
15 additions
and
180 deletions
AKModel/tests/test_json_export.py
+
15
−
180
View file @
0e9d0faf
...
@@ -128,204 +128,41 @@ class JSONExportTest(TestCase):
...
@@ -128,204 +128,41 @@ class JSONExportTest(TestCase):
if
contained_type
in
{
str
,
int
}:
if
contained_type
in
{
str
,
int
}:
self
.
_check_uniqueness
(
lst
,
name
,
key
=
None
)
self
.
_check_uniqueness
(
lst
,
name
,
key
=
None
)
def
test_
ak_
conformity_to_s
pec
(
self
):
def
test_conformity_to_s
chema
(
self
):
"""
Test if
AK
JSON structure and types conform to s
tandard
.
"""
"""
Test if JSON structure and types conform to s
chema
.
"""
for
event
in
Event
.
objects
.
all
():
for
event
in
Event
.
objects
.
all
():
with
self
.
subTest
(
event
=
event
):
with
self
.
subTest
(
event
=
event
):
self
.
set_up_event
(
event
=
event
)
self
.
set_up_event
(
event
=
event
)
self
.
_check_uniqueness
(
self
.
export_dict
[
"
aks
"
],
"
AK
"
)
errors
=
list
(
self
.
json_export_validator
.
iter_errors
(
self
.
export_dict
))
for
ak
in
self
.
export_dict
[
"
aks
"
]:
msg
=
""
if
not
errors
else
best_match
(
errors
).
message
item
=
f
"
AK
{
ak
[
'
id
'
]
}
"
self
.
assertFalse
(
errors
,
msg
)
self
.
assertEqual
(
ak
.
keys
(),
{
"
id
"
,
"
duration
"
,
"
properties
"
,
"
room_constraints
"
,
"
time_constraints
"
,
"
info
"
,
},
f
"
{
item
}
keys not as expected
"
,
)
self
.
assertEqual
(
ak
[
"
info
"
].
keys
(),
{
"
name
"
,
"
head
"
,
"
description
"
,
"
reso
"
,
"
duration_in_hours
"
,
"
django_ak_id
"
,
"
types
"
,
},
f
"
{
item
}
info keys not as expected
"
,
)
self
.
assertEqual
(
ak
[
"
properties
"
].
keys
(),
{
"
conflicts
"
,
"
dependencies
"
},
f
"
{
item
}
properties keys not as expected
"
,
)
self
.
_check_type
(
ak
[
"
id
"
],
int
,
"
id
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
duration
"
],
int
,
"
duration
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
info
"
][
"
name
"
],
str
,
"
info/name
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
info
"
][
"
head
"
],
str
,
"
info/head
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
info
"
][
"
description
"
],
str
,
"
info/description
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
info
"
][
"
reso
"
],
bool
,
"
info/reso
"
,
item
=
item
)
self
.
_check_type
(
ak
[
"
info
"
][
"
duration_in_hours
"
],
float
,
"
info/duration_in_hours
"
,
item
=
item
,
)
self
.
_check_type
(
ak
[
"
info
"
][
"
django_ak_id
"
],
int
,
"
info/django_ak_id
"
,
item
=
item
,
)
self
.
_check_lst
(
def
test_id_uniqueness
(
self
):
ak
[
"
properties
"
][
"
conflicts
"
],
"""
Test if objects are only exported once.
"""
"
conflicts
"
,
item
=
item
,
contained_type
=
int
,
)
self
.
_check_lst
(
ak
[
"
properties
"
][
"
dependencies
"
],
"
dependencies
"
,
item
=
item
,
contained_type
=
int
,
)
self
.
_check_lst
(
ak
[
"
time_constraints
"
],
"
time_constraints
"
,
item
=
item
)
self
.
_check_lst
(
ak
[
"
room_constraints
"
],
"
room_constraints
"
,
item
=
item
)
def
test_room_conformity_to_spec
(
self
):
"""
Test if Room JSON structure and types conform to standard.
"""
for
event
in
Event
.
objects
.
all
():
for
event
in
Event
.
objects
.
all
():
with
self
.
subTest
(
event
=
event
):
with
self
.
subTest
(
event
=
event
):
self
.
set_up_event
(
event
=
event
)
self
.
set_up_event
(
event
=
event
)
self
.
_check_uniqueness
(
self
.
export_dict
[
"
rooms
"
],
"
Room
"
)
self
.
_check_uniqueness
(
self
.
export_dict
[
"
aks
"
],
"
AKs
"
)
for
room
in
self
.
export_dict
[
"
rooms
"
]:
self
.
_check_uniqueness
(
self
.
export_dict
[
"
rooms
"
],
"
Rooms
"
)
item
=
f
"
Room
{
room
[
'
id
'
]
}
"
self
.
_check_uniqueness
(
self
.
export_dict
[
"
participants
"
],
"
Participants
"
)
self
.
assertEqual
(
room
.
keys
(),
{
"
id
"
,
"
info
"
,
"
capacity
"
,
"
fulfilled_room_constraints
"
,
"
time_constraints
"
,
},
f
"
{
item
}
keys not as expected
"
,
)
self
.
assertEqual
(
room
[
"
info
"
].
keys
(),
{
"
name
"
},
f
"
{
item
}
info keys not as expected
"
,
)
self
.
_check_type
(
room
[
"
id
"
],
int
,
"
id
"
,
item
=
item
)
self
.
_check_type
(
room
[
"
capacity
"
],
int
,
"
capacity
"
,
item
=
item
)
self
.
_check_type
(
room
[
"
info
"
][
"
name
"
],
str
,
"
info/name
"
,
item
=
item
)
self
.
assertTrue
(
room
[
"
capacity
"
]
>
0
or
room
[
"
capacity
"
]
==
-
1
,
"
invalid room capacity
"
,
)
self
.
_check_lst
(
room
[
"
time_constraints
"
],
"
time_constraints
"
,
item
=
item
)
self
.
_check_lst
(
room
[
"
fulfilled_room_constraints
"
],
"
fulfilled_room_constraints
"
,
item
=
item
,
)
def
test_timeslots_conformity_to_spec
(
self
):
"""
Test if Timeslots JSON structure and types conform to standard.
"""
for
event
in
Event
.
objects
.
all
():
with
self
.
subTest
(
event
=
event
):
self
.
set_up_event
(
event
=
event
)
self
.
_check_uniqueness
(
self
.
_check_uniqueness
(
chain
.
from_iterable
(
self
.
export_dict
[
"
timeslots
"
][
"
blocks
"
]),
chain
.
from_iterable
(
self
.
export_dict
[
"
timeslots
"
][
"
blocks
"
]),
"
Timeslots
"
,
"
Timeslots
"
,
)
)
item
=
"
timeslots
"
self
.
assertEqual
(
self
.
export_dict
[
"
timeslots
"
].
keys
(),
{
"
info
"
,
"
blocks
"
},
"
timeslot keys not as expected
"
,
)
self
.
assertEqual
(
self
.
export_dict
[
"
timeslots
"
][
"
info
"
].
keys
(),
{
"
duration
"
,
"
blocknames
"
},
"
timeslot info keys not as expected
"
,
)
self
.
_check_type
(
self
.
export_dict
[
"
timeslots
"
][
"
info
"
][
"
duration
"
],
float
,
"
info/duration
"
,
item
=
item
,
)
self
.
_check_lst
(
self
.
export_dict
[
"
timeslots
"
][
"
info
"
][
"
blocknames
"
],
"
info/blocknames
"
,
item
=
item
,
contained_type
=
list
,
)
for
blockname
in
self
.
export_dict
[
"
timeslots
"
][
"
info
"
][
"
blocknames
"
]:
self
.
assertEqual
(
len
(
blockname
),
2
)
self
.
_check_lst
(
blockname
,
"
info/blocknames/entry
"
,
item
=
item
,
contained_type
=
str
,
)
self
.
_check_lst
(
def
test_timeslot_ids_consecutive
(
self
):
self
.
export_dict
[
"
timeslots
"
][
"
blocks
"
],
"""
Test if Timeslots ids are chronologically consecutive.
"""
"
blocks
"
,
for
event
in
Event
.
objects
.
all
():
item
=
item
,
with
self
.
subTest
(
event
=
event
):
contained_type
=
list
,
self
.
set_up_event
(
event
=
event
)
)
prev_id
=
None
prev_id
=
None
for
timeslot
in
chain
.
from_iterable
(
for
timeslot
in
chain
.
from_iterable
(
self
.
export_dict
[
"
timeslots
"
][
"
blocks
"
]
self
.
export_dict
[
"
timeslots
"
][
"
blocks
"
]
):
):
item
=
f
"
timeslot
{
timeslot
[
'
id
'
]
}
"
self
.
assertEqual
(
timeslot
.
keys
(),
{
"
id
"
,
"
info
"
,
"
fulfilled_time_constraints
"
},
f
"
{
item
}
keys not as expected
"
,
)
self
.
assertEqual
(
timeslot
[
"
info
"
].
keys
(),
{
"
start
"
,
"
end
"
},
f
"
{
item
}
info keys not as expected
"
,
)
self
.
_check_type
(
timeslot
[
"
id
"
],
int
,
"
id
"
,
item
=
item
)
self
.
_check_type
(
timeslot
[
"
info
"
][
"
start
"
],
str
,
"
info/start
"
,
item
=
item
)
self
.
_check_lst
(
timeslot
[
"
fulfilled_time_constraints
"
],
"
fulfilled_time_constraints
"
,
item
=
item
,
)
if
prev_id
is
not
None
:
if
prev_id
is
not
None
:
self
.
assertLess
(
self
.
assertLess
(
prev_id
,
prev_id
,
...
@@ -360,8 +197,6 @@ class JSONExportTest(TestCase):
...
@@ -360,8 +197,6 @@ class JSONExportTest(TestCase):
getattr
(
self
.
event
,
attr_field
),
self
.
export_dict
[
"
info
"
][
attr
]
getattr
(
self
.
event
,
attr_field
),
self
.
export_dict
[
"
info
"
][
attr
]
)
)
self
.
_check_uniqueness
(
self
.
export_dict
[
"
participants
"
],
"
Participants
"
)
def
test_ak_durations
(
self
):
def
test_ak_durations
(
self
):
"""
Test if all AK durations are correct.
"""
"""
Test if all AK durations are correct.
"""
for
event
in
Event
.
objects
.
all
():
for
event
in
Event
.
objects
.
all
():
...
...
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