Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adex-data-scraper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
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
adex-data-scraper
Commits
ee1a4f3e
Commit
ee1a4f3e
authored
2 years ago
by
Robbie Luijben
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation
parent
75183b0c
No related branches found
No related tags found
1 merge request
!7
Improve test coverage
Pipeline
#45814
passed
2 years ago
Stage: package_to_gitlab
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_beam.py
+22
-4
22 additions, 4 deletions
tests/test_beam.py
tests/test_connectors_postgres.py
+5
-4
5 additions, 4 deletions
tests/test_connectors_postgres.py
with
27 additions
and
8 deletions
tests/test_beam.py
+
22
−
4
View file @
ee1a4f3e
...
@@ -5,16 +5,34 @@ from scripts.beam import calc_beam
...
@@ -5,16 +5,34 @@ from scripts.beam import calc_beam
class
TestBeam
(
unittest
.
TestCase
):
class
TestBeam
(
unittest
.
TestCase
):
def
test_calc_beam_no_beam_number_at_all
(
self
):
def
test_calc_beam_no_beam_number_at_all
(
self
):
actual
=
calc_beam
(
"
abc
"
)
# arrange
name
=
"
abc
"
expected
=
0
expected
=
0
# act
actual
=
calc_beam
(
name
)
# assert
self
.
assertEqual
(
actual
,
expected
)
self
.
assertEqual
(
actual
,
expected
)
def
test_calc_beam_no_beam_number_but_partial_match_no_dot
(
self
):
def
test_calc_beam_no_beam_number_but_partial_match_no_dot
(
self
):
actual
=
calc_beam
(
"
_BXXXXX
"
)
# arrange
name
=
"
_BXXXXX
"
expected
=
0
expected
=
0
# act
actual
=
calc_beam
(
name
)
# assert
self
.
assertEqual
(
actual
,
expected
)
self
.
assertEqual
(
actual
,
expected
)
def
test_calc_beam_valid_beam_number
(
self
):
def
test_calc_beam_valid_beam_number
(
self
):
actual
=
calc_beam
(
"
_B099.
"
)
# arrange
name
=
"
_B099.
"
expected
=
99
expected
=
99
# act
actual
=
calc_beam
(
name
)
# assert
self
.
assertEqual
(
actual
,
expected
)
self
.
assertEqual
(
actual
,
expected
)
This diff is collapsed.
Click to expand it.
tests/test_connectors_postgres.py
+
5
−
4
View file @
ee1a4f3e
...
@@ -5,8 +5,8 @@ from scraper.postgres.connectors.apertif import Inspectionplots
...
@@ -5,8 +5,8 @@ from scraper.postgres.connectors.apertif import Inspectionplots
class
TestConnectorPostgresApertif
(
unittest
.
TestCase
):
class
TestConnectorPostgresApertif
(
unittest
.
TestCase
):
def
test_translate
(
self
):
def
test_translate
(
self
):
# arrange
connector
=
Inspectionplots
()
connector
=
Inspectionplots
()
name
=
'
my_name
'
name
=
'
my_name
'
pid
=
5
pid
=
5
url
=
'
some_access_url
'
url
=
'
some_access_url
'
...
@@ -17,8 +17,6 @@ class TestConnectorPostgresApertif(unittest.TestCase):
...
@@ -17,8 +17,6 @@ class TestConnectorPostgresApertif(unittest.TestCase):
args_collection
=
[
1
,
2
,
3
]
args_collection
=
[
1
,
2
,
3
]
args
=
types
.
SimpleNamespace
(
collection
=
args_collection
)
args
=
types
.
SimpleNamespace
(
collection
=
args_collection
)
actual
=
connector
.
translate
(
row
=
row
,
args
=
args
)
expected
=
{
expected
=
{
'
pid
'
:
pid
,
'
pid
'
:
pid
,
'
name
'
:
name
,
'
name
'
:
name
,
...
@@ -31,5 +29,8 @@ class TestConnectorPostgresApertif(unittest.TestCase):
...
@@ -31,5 +29,8 @@ class TestConnectorPostgresApertif(unittest.TestCase):
'
collection
'
:
args_collection
,
'
collection
'
:
args_collection
,
}
}
self
.
assertDictEqual
(
actual
,
expected
)
# act
actual
=
connector
.
translate
(
row
=
row
,
args
=
args
)
# assert
self
.
assertDictEqual
(
actual
,
expected
)
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