Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
atdb-ldv
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASTRON SDC
atdb-ldv
Commits
52bd7c11
Commit
52bd7c11
authored
1 year ago
by
Nico Vermaas
Browse files
Options
Downloads
Patches
Plain Diff
adding unittests
parent
6f8c5c0d
No related branches found
No related tags found
2 merge requests
!304
update branch with master
,
!302
automatic quality validation
Pipeline
#52209
passed
1 year ago
Stage: build
Stage: deploy_to_test
Stage: deploy_to_production
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
atdb/taskdatabase/tests.py
+34
-1
34 additions, 1 deletion
atdb/taskdatabase/tests.py
with
34 additions
and
1 deletion
atdb/taskdatabase/tests.py
+
34
−
1
View file @
52bd7c11
...
@@ -334,4 +334,37 @@ class TestCalculatedQualities(TestCase):
...
@@ -334,4 +334,37 @@ class TestCalculatedQualities(TestCase):
self
.
assertEqual
(
quality_values
,{
'
poor
'
:
0
,
'
moderate
'
:
1
,
'
good
'
:
3
})
self
.
assertEqual
(
quality_values
,{
'
poor
'
:
0
,
'
moderate
'
:
1
,
'
good
'
:
3
})
# 3 out of 4 are 'good', 75% is above the 50% threshold, so 'good'
# 3 out of 4 are 'good', 75% is above the 50% threshold, so 'good'
self
.
assertEqual
(
quality_per_sasid
,
'
good
'
)
self
.
assertEqual
(
quality_per_sasid
,
'
good
'
)
\ No newline at end of file
def
test_faulty_thresholds
(
self
):
"""
what happens if the user makes a typo in the threshold?
"""
# faulty thresholds
quality_thresholds
=
{
"
moderate
"
:
"
a
"
,
"
poor
"
:
50
,
"
overall_poor
"
:
50
,
"
overall_good
"
:
90
,
}
# get the tasks for sas_id 54321
tasks_for_this_sasid
=
Task
.
objects
.
filter
(
sas_id
=
54321
)
# run the algorithms and gather the values
quality_values
=
{
'
poor
'
:
0
,
'
moderate
'
:
0
,
'
good
'
:
0
}
quality_per_sasid
=
None
for
task
in
tasks_for_this_sasid
:
q
=
qualities
.
calculate_qualities
(
task
,
tasks_for_this_sasid
,
quality_thresholds
)
try
:
key
=
task
.
calculated_qualities
[
'
per_task
'
]
quality_values
[
key
]
=
quality_values
[
key
]
+
1
quality_per_sasid
=
task
.
calculated_qualities
[
'
per_sasid
'
]
except
:
# ignore the tasks that have no calculated quality.
pass
self
.
assertEqual
(
quality_values
,
{
'
poor
'
:
0
,
'
moderate
'
:
0
,
'
good
'
:
0
})
self
.
assertEqual
(
quality_per_sasid
,
None
)
\ No newline at end of file
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