Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
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
AURA
steering
Commits
7a356089
Verified
Commit
7a356089
authored
8 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: fix calendar program tests
parent
9a86a397
No related branches found
No related tags found
1 merge request
!54
fix(program-generation): fix undefined behaviour around start and end query parameters
Pipeline
#8350
passed
8 months ago
Stage: check
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/tests/test_calendar_program.py
+16
-12
16 additions, 12 deletions
program/tests/test_calendar_program.py
with
16 additions
and
12 deletions
program/tests/test_calendar_program.py
+
16
−
12
View file @
7a356089
...
...
@@ -21,7 +21,7 @@ def url(include_virtual=False, start=None, end=None):
def
assert_episodes
(
episodes
,
one_week
=
False
)
->
None
:
"""
asserts the episodes are valid.
"""
assert
len
(
episodes
)
==
1
if
not
one_week
else
7
assert
len
(
episodes
)
==
2
if
not
one_week
else
7
for
episode
in
episodes
:
assert
episode
[
"
id
"
]
...
...
@@ -31,20 +31,24 @@ def assert_episodes(episodes, one_week=False) -> None:
def
assert_program
(
program
,
show
,
fallback_show
=
None
,
one_week
=
False
)
->
None
:
"""
asserts the program are valid and correspond to the given show and fallback show.
"""
assert
len
(
program
)
==
1
if
fallback_show
is
None
and
not
one_week
else
(
7
if
one_week
else
3
)
assert
len
(
program
)
==
2
if
fallback_show
is
None
and
not
one_week
else
(
7
if
one_week
else
3
)
assert
program
[
0
][
"
end
"
]
assert
program
[
0
][
"
id
"
]
assert
program
[
0
][
"
start
"
]
for
entry
in
program
:
assert
entry
[
"
end
"
]
assert
entry
[
"
id
"
]
assert
entry
[
"
start
"
]
if
fallback_show
is
None
:
assert
program
[
0
][
"
showId
"
]
==
show
.
id
assert
program
[
0
][
"
timeslotId
"
]
for
entry
in
program
:
assert
entry
[
"
showId
"
]
==
show
.
id
assert
entry
[
"
timeslotId
"
]
else
:
assert
program
[
0
][
"
showId
"
]
==
fallback_show
.
id
assert
program
[
1
][
"
showId
"
]
==
show
.
id
assert
program
[
1
][
"
timeslotId
"
]
for
entry
in
program
:
if
entry
[
"
timeslotId
"
]:
assert
entry
[
"
showId
"
]
==
show
.
id
assert
entry
[
"
timeslotId
"
]
else
:
assert
entry
[
"
showId
"
]
==
fallback_show
.
id
def
assert_shows
(
shows
,
show
,
fallback_show
=
None
)
->
None
:
...
...
@@ -66,7 +70,7 @@ def assert_shows(shows, show, fallback_show=None) -> None:
def
assert_timeslots
(
timeslots
,
show
,
one_week
=
False
)
->
None
:
"""
asserts the timeslots are valid and correspond to the given show.
"""
assert
len
(
timeslots
)
==
1
if
not
one_week
else
7
assert
len
(
timeslots
)
==
2
if
not
one_week
else
7
for
timeslot
in
timeslots
:
assert
timeslot
[
"
id
"
]
...
...
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