From ca9472ed7cc880a9d20df536d9800692b8d72c82 Mon Sep 17 00:00:00 2001
From: Mark Driver <mdd31@alumni.cam.ac.uk>
Date: Wed, 19 Feb 2020 13:14:11 +0000
Subject: [PATCH] doc and test clean up updates.

---
 .../analysistest/similarityanalysistest.py    | 23 ++++++++++++++-----
 .../iotest/systemcollectionprocessortest.py   |  8 +++++--
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/phasecalculator/test/analysistest/similarityanalysistest.py b/phasecalculator/test/analysistest/similarityanalysistest.py
index 8d8f3bc..93920e1 100755
--- a/phasecalculator/test/analysistest/similarityanalysistest.py
+++ b/phasecalculator/test/analysistest/similarityanalysistest.py
@@ -25,6 +25,7 @@ import unittest
 import pandas
 import pathlib
 import numpy as np
+import os
 import phasecalculator.analysis.similarityanalysis as simanalysis
 
 
@@ -61,8 +62,18 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
         None.
 
         """
+        del self.expected_free_poly
+        del self.expected_matrix_file
+        del self.example_with_pure_data
+        del self.example_matrix
+        if os.path.isfile(self.actual_matrix_file):
+            os.remove(self.actual_matrix_file)
+        if os.path.isfile(self.actual_series_file):
+            os.remove(self.actual_series_file)
+        del self.actual_matrix_file
+        del self.actual_series_file
     def test_read_polynomial_files(self):
-        """Test
+        """Test expected information is read.
 
         Returns
         -------
@@ -90,7 +101,7 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
                 else:
                     self.assertEqual(value, expected_dict['resourcesexpected,parsed'][8][region][key])
     def test_compare_all_solvents(self):
-        """Test
+        """Test complete matrix is produced.
 
         Returns
         -------
@@ -102,7 +113,7 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
         actual_dataframe = pandas.read_csv(self.actual_matrix_file, sep="\t",header=0,index_col=0)
         self.assertEqual((262,262), actual_dataframe.shape)
     def test_compare_with_pure_solvents(self):
-        """Test
+        """Test column matrix is produced.
 
         Returns
         -------
@@ -115,7 +126,7 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
         actual_dataframe = pandas.read_csv(self.actual_series_file, sep="\t",header=0,index_col=0)
         self.assertEqual((261,1), actual_dataframe.shape)
     def test_compare_solvent_list(self):
-        """Test
+        """Test expected matrix is produced.
 
         Returns
         -------
@@ -127,7 +138,7 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
         actual_dataframe = pandas.read_csv(self.actual_matrix_file, sep="\t",header=0,index_col=0)
         self.assertEqual((1,1), actual_dataframe.shape)
     def test_write_frame_to_file(self):
-        """Test
+        """Test expected file is exists.
 
         Returns
         -------
@@ -137,7 +148,7 @@ class SimilarityAnalysisTestCase(unittest.TestCase):
         simanalysis.write_frame_to_file(self.example_matrix, self.actual_matrix_file)
         self.assertTrue(pathlib.Path(self.actual_matrix_file).is_file())
     def test_extract_comparison_to_pure_solvents(self):
-        """Test
+        """Test expected comparisons are produced.
 
         Returns
         -------
diff --git a/phasecalculator/test/iotest/systemcollectionprocessortest.py b/phasecalculator/test/iotest/systemcollectionprocessortest.py
index 201380b..378e368 100755
--- a/phasecalculator/test/iotest/systemcollectionprocessortest.py
+++ b/phasecalculator/test/iotest/systemcollectionprocessortest.py
@@ -23,6 +23,7 @@ Test case for System Collection Processor methods.
 import logging
 import unittest
 from lxml import etree
+import os
 from phasecalculator.classes.temperature import Temperature
 from phasecalculator.classes.molecule import Molecule
 from phasecalculator.classes.phase import Phase
@@ -75,8 +76,11 @@ class SystemCollectionProcessorTestCase(unittest.TestCase):
         del self.out_inf
         del self.system
         del self.system_collection
+        if os.path.isfile(self.xml_filename):
+            os.remove(self.xml_filename)
+        del self.xml_filename
     def test_read_system_collection_file(self):
-        """Test
+        """Test expected collection is read in
 
         Returns
         -------
@@ -86,7 +90,7 @@ class SystemCollectionProcessorTestCase(unittest.TestCase):
         actual_sys_collection = sysproc.read_system_collection_file(self.xml_filename)
         self.assertEqual(self.system_collection, actual_sys_collection)
     def test_write_system_collection_file(self):
-        """Test
+        """Test file contents produced as expected.
 
         Returns
         -------
-- 
GitLab