From 1f300e345ecff2dcff9886208561dceaa4251a30 Mon Sep 17 00:00:00 2001
From: "Anders H. Rebner" <anderhre@stud.ntnu.no>
Date: Mon, 2 Mar 2020 10:13:23 +0100
Subject: [PATCH] #5 Tilpasset docstrings

---
 soitool/database.py   | 16 ++++++++++------
 test/test_database.py | 10 ++--------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/soitool/database.py b/soitool/database.py
index 66b8f7c..98d5092 100644
--- a/soitool/database.py
+++ b/soitool/database.py
@@ -1,4 +1,4 @@
-"""Database."""
+"""Includes all database-related functionality."""
 import os
 import sqlite3
 import json
@@ -18,10 +18,14 @@ BYHEART = 'CREATE TABLE ByHeart(Word VARCHAR PRIMARY KEY)'
 
 
 class Database():
-    """Holds connection to database."""
+    """
+    Holds database-connection and related functions.
+
+    Connects to existing db if found, creates new db if not.
+    If db is created, tables are created and filled.
+    """
 
     def __init__(self):
-        """Connect to existing db if found, create new db if not."""
         db_exists = os.path.exists(DBPATH)
 
         if db_exists:
@@ -122,19 +126,19 @@ class Database():
 
     def get_codebook(self, small=False):
         """
-        Retrive the entries belonging to the small codebook or big codebook.
+        Retrieve the entries belonging to the full or small codebook.
 
         Parameters
         ----------
         small : Bool
-            Full or smal codebook to be returned
+            Full or small codebook to be returned
 
         Returns
         -------
         codebook : list (of dicts)
             [{'word': str, 'type': str, 'category': str, 'code': str}]
         """
-        # Get either small or whole codebook
+        # Get either full or small codebook
         stmt = 'SELECT * FROM CodeBook'
         if small:
             stmt = stmt + ' WHERE Type = ?'
diff --git a/test/test_database.py b/test/test_database.py
index dd1b058..38c8278 100644
--- a/test/test_database.py
+++ b/test/test_database.py
@@ -9,13 +9,7 @@ TESTDATA_PATH = Path(__file__).parent.parent / "soitool/testdata"
 
 
 class DatabaseTest(unittest.TestCase):
-    """Database tests.
-
-    Parameters
-    ----------
-    unittest : Testcase
-        DatabaseTest is subclass of TestCase
-    """
+    """Database tests."""
 
     def setUp(self):
         """Connect to/create database."""
@@ -128,7 +122,7 @@ class DatabaseTest(unittest.TestCase):
         categories_db = self.database.get_categories()
         self.assertEqual(categories_file, categories_db)
 
-    def test_getcodebook(self):
+    def test_get_codebook(self):
         """Assert function get_codebook returns full codebook."""
         # Load full codebook
         file_path = os.path.join(TESTDATA_PATH, "codebook.json")
-- 
GitLab