Skip to content
Snippets Groups Projects
Commit ee1a4f3e authored by Robbie Luijben's avatar Robbie Luijben
Browse files

Added documentation

parent 75183b0c
No related branches found
No related tags found
1 merge request!7Improve test coverage
Pipeline #45814 passed
...@@ -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)
...@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment