From ee1a4f3ec91eb88af22e1df24faf098460092ee3 Mon Sep 17 00:00:00 2001 From: Robbie Luijben <luijben@astron.nl> Date: Thu, 16 Mar 2023 15:17:55 +0100 Subject: [PATCH] Added documentation --- tests/test_beam.py | 26 ++++++++++++++++++++++---- tests/test_connectors_postgres.py | 9 +++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tests/test_beam.py b/tests/test_beam.py index fa028bf..6a4ae3e 100644 --- a/tests/test_beam.py +++ b/tests/test_beam.py @@ -5,16 +5,34 @@ from scripts.beam import calc_beam class TestBeam(unittest.TestCase): def test_calc_beam_no_beam_number_at_all(self): - actual = calc_beam("abc") + # arrange + name = "abc" expected = 0 + + # act + actual = calc_beam(name) + + # assert self.assertEqual(actual, expected) def test_calc_beam_no_beam_number_but_partial_match_no_dot(self): - actual = calc_beam("_BXXXXX") + # arrange + name = "_BXXXXX" expected = 0 + + # act + actual = calc_beam(name) + + # assert self.assertEqual(actual, expected) def test_calc_beam_valid_beam_number(self): - actual = calc_beam("_B099.") + # arrange + name = "_B099." expected = 99 - self.assertEqual(actual, expected) \ No newline at end of file + + # act + actual = calc_beam(name) + + # assert + self.assertEqual(actual, expected) diff --git a/tests/test_connectors_postgres.py b/tests/test_connectors_postgres.py index 39504d5..5e85288 100644 --- a/tests/test_connectors_postgres.py +++ b/tests/test_connectors_postgres.py @@ -5,8 +5,8 @@ from scraper.postgres.connectors.apertif import Inspectionplots class TestConnectorPostgresApertif(unittest.TestCase): def test_translate(self): + # arrange connector = Inspectionplots() - name = 'my_name' pid = 5 url = 'some_access_url' @@ -17,8 +17,6 @@ class TestConnectorPostgresApertif(unittest.TestCase): args_collection = [1, 2, 3] args = types.SimpleNamespace(collection=args_collection) - actual = connector.translate(row=row, args=args) - expected = { 'pid': pid, 'name': name, @@ -31,5 +29,8 @@ class TestConnectorPostgresApertif(unittest.TestCase): 'collection': args_collection, } - self.assertDictEqual(actual, expected) + # act + actual = connector.translate(row=row, args=args) + # assert + self.assertDictEqual(actual, expected) -- GitLab