From 12a48195ac368018a987593d05d29cf693b7f141 Mon Sep 17 00:00:00 2001 From: lnksz Date: Sun, 1 Oct 2017 22:17:56 +0200 Subject: [PATCH] Extend docstrings for autodocs --- rivus/tests/test_db.py | 18 +++++++++++++++++- rivus/tests/test_gridder.py | 2 +- rivus/tests/test_main.py | 2 +- rivus/tests/test_utils.py | 29 ++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/rivus/tests/test_db.py b/rivus/tests/test_db.py index 43feed5..d41036f 100644 --- a/rivus/tests/test_db.py +++ b/rivus/tests/test_db.py @@ -18,10 +18,26 @@ class RivusDBTest(unittest.TestCase): def test_df_insert_query(self): """Are the stored dataframes and the retrieved ones identical? - - Comparison form is *after* create_model. (index is set) + + - Comparison form of frames is *after* create_model. (index is set) - Comparison form expects that input dataframes only have meaningful columns. (See pull request #23) - Only implemented dataframes are tested. + + Note + ---- + Requires a ``config.json`` file in the root of rivus-repo with the + database credentials. For Example: + :: + + { + "db" : { + "user" : "postgres", + "pass" : "postgres", + "host" : "localhost", + "base" : "rivus" + } + } """ conf_path = os.path.join(pdir(pdir(pdir(__file__))), 'config.json') config = [] diff --git a/rivus/tests/test_gridder.py b/rivus/tests/test_gridder.py index f4baba0..7135ec3 100644 --- a/rivus/tests/test_gridder.py +++ b/rivus/tests/test_gridder.py @@ -5,7 +5,7 @@ from rivus.main.rivus import read_excel -class RivusTest(unittest.TestCase): +class RivusGridTest(unittest.TestCase): # TODO There is plenty of more functions (if not all) # which reside in the code-base untested. Bellow some placeholders. diff --git a/rivus/tests/test_main.py b/rivus/tests/test_main.py index 34604c1..f87e748 100644 --- a/rivus/tests/test_main.py +++ b/rivus/tests/test_main.py @@ -2,7 +2,7 @@ from rivus.main.rivus import read_excel -class RivusTest(unittest.TestCase): +class RivusMainTest(unittest.TestCase): # TODO There is plenty of more functions (if not all) # which reside in the code-base untested. Bellow some placeholders. diff --git a/rivus/tests/test_utils.py b/rivus/tests/test_utils.py index 04c828b..73f2f4a 100644 --- a/rivus/tests/test_utils.py +++ b/rivus/tests/test_utils.py @@ -7,9 +7,15 @@ import json -class RivusTest(unittest.TestCase): +class RivusUtilsTest(unittest.TestCase): def test_parameter_range(self): + """Load minimal example data and test with one of the parameters + + + Tests for side-effects on the original. + + Tests for the awaited numer of parameters. + + Tests for range of the parameters + """ proj_name = 'mnl' base_directory = os.path.join('data', proj_name) data_spreadsheet = os.path.join(base_directory, 'data.xlsx') @@ -44,6 +50,27 @@ def test_parameter_range(self): msg='Got parameter smaller than awaited.') def test_email_notification(self): + """It only can test, whether the notification function run trhrough + successfully. + + Can be useful for quick testing the email parameters in the config file + + Note + ----- + Requires a ``config.json`` file in the root of rivus-repo with the + database credentials. For Example: + :: + + { + "email" : { + "s_user" : "robot.mail@gmail.com", + "s_pass" : "TheAnswerIs42!", + "r_user" : "my.mail@gmail.com", + "smpt_addr" : "smtp.gmail.com", + "smpt_port" : "587" + } + } + """ # Concatenate the absolute path to the config file. # conf_path = __file__[:-len('rivus/tests/utils.py')] + 'config.json' conf_path = os.path.join(pdir(pdir(pdir(__file__))), 'config.json')