From e6ea0cd3343714706224d2de1f5d408838ef08fc Mon Sep 17 00:00:00 2001 From: Mark Driver <mdd31@cam.ac.uk> Date: Wed, 11 Jul 2018 17:59:11 +0100 Subject: [PATCH] updates due to change in resultsanalysis repository. --- .../test/iotest/polynomialdatareadertest.py | 5 +++-- .../test/iotest/polynomialdatawritertest.py | 22 +++++++++---------- .../test/resources/expected_poly_fit.csv | 2 +- .../test/resources/expected_poly_fit2.csv | 4 ++-- .../test/resources/water_poly_fit.csv | 4 ++-- .../test/resources/water_poly_fit_split.csv | 8 +++---- .../test/resources/water_poly_fit_subset.csv | 4 ++-- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/solventmapcreator/test/iotest/polynomialdatareadertest.py b/solventmapcreator/test/iotest/polynomialdatareadertest.py index 4867ed8..bf2d0d2 100644 --- a/solventmapcreator/test/iotest/polynomialdatareadertest.py +++ b/solventmapcreator/test/iotest/polynomialdatareadertest.py @@ -22,9 +22,10 @@ class PolynomialDataReaderTestCase(unittest.TestCase): """Set up for tests. """ self.expected_list = [['Order','Fit Range', 'RMSE', 'Covariance', 'Coefficients'], - ['1', 'All', '0.0154303', '0.0007143', '-0.0500000', '1.0714286']] + ['1', 'All', '0.0154303350', '7.142857142857E-04', + '-5.000000000000E-02', '1.071428571429E+00']] self.expected_data_by_solvent_id = {"expected,poly,fit":{1:{"coefficients":np.array([-0.05, - 1.07142857]), + 1.071428571429]), "RMSE":0.015430334996209221, "order":1, "covar":0.0007143}}} diff --git a/solventmapcreator/test/iotest/polynomialdatawritertest.py b/solventmapcreator/test/iotest/polynomialdatawritertest.py index 1789511..5015442 100644 --- a/solventmapcreator/test/iotest/polynomialdatawritertest.py +++ b/solventmapcreator/test/iotest/polynomialdatawritertest.py @@ -36,10 +36,10 @@ class PolynomialDataWriterTestCase(unittest.TestCase): Value(0.5, 'Log(Sw)', Units.dimensionless), 'EXAMPLE3')]) self.datapoints.createDataArrays() self.expected_polynomial_data = {1:{"coefficients":np.array([-0.05, - 1.07142857]), + 1.071428571429]), "RMSE":0.015430334996209221, "order":1, - "covar":np.array([0.0007143])}} + "covar":np.array([0.0007142857142857])}} self.expected_file_name = "resources/expected_poly_fit.csv" def tearDown(self): """Tear down after tests @@ -66,10 +66,10 @@ class PolynomialDataWriterTestCase(unittest.TestCase): 'EXAMPLE3']) self.assertEqual(0, poly_file_out) with open(expected_file_name, 'r') as exp_file: - exp_file_lines = exp_file.readlines() + exp_file_lines = exp_file.read() with open(actual_file_name, 'r') as act_file: - act_file_lines = act_file.readlines() - self.assertListEqual(act_file_lines, exp_file_lines) + act_file_lines = act_file.read() + self.assertMultiLineEqual(act_file_lines, exp_file_lines) def test_write_poly_data_to_file(self): """Test to see if expected file is produced. """ @@ -78,10 +78,10 @@ class PolynomialDataWriterTestCase(unittest.TestCase): [1], actual_file_name) self.assertEqual(0, poly_file_out) with open(self.expected_file_name, 'r') as exp_file: - exp_file_lines = exp_file.readlines() + exp_file_lines = exp_file.read() with open(actual_file_name, 'r') as act_file: - act_file_lines = act_file.readlines() - self.assertListEqual(act_file_lines, exp_file_lines) + act_file_lines = act_file.read() + self.assertMultiLineEqual(act_file_lines, exp_file_lines) def test_write_poly_fit_data_to_file(self): """Test to see if expected file is produced. """ @@ -90,10 +90,10 @@ class PolynomialDataWriterTestCase(unittest.TestCase): actual_file_name) self.assertEqual(0, poly_file_out) with open(self.expected_file_name, 'r') as exp_file: - exp_file_lines = exp_file.readlines() + exp_file_lines = exp_file.read() with open(actual_file_name, 'r') as act_file: - act_file_lines = act_file.readlines() - self.assertListEqual(act_file_lines, exp_file_lines) + act_file_lines = act_file.read() + self.assertMultiLineEqual(act_file_lines, exp_file_lines) def test_generate_poly_fit_data_order_list_split_fit(self): """Test to see if expected dictionary is returned. """ diff --git a/solventmapcreator/test/resources/expected_poly_fit.csv b/solventmapcreator/test/resources/expected_poly_fit.csv index 7dade02..29022a7 100644 --- a/solventmapcreator/test/resources/expected_poly_fit.csv +++ b/solventmapcreator/test/resources/expected_poly_fit.csv @@ -1,2 +1,2 @@ Order Fit Range RMSE Covariance Coefficients -1 All 0.0154303 0.0007143 -0.0500000 1.0714286 +1 All 0.0154303350 7.142857142857E-04 -5.000000000000E-02 1.071428571429E+00 diff --git a/solventmapcreator/test/resources/expected_poly_fit2.csv b/solventmapcreator/test/resources/expected_poly_fit2.csv index bf4273c..088ca99 100644 --- a/solventmapcreator/test/resources/expected_poly_fit2.csv +++ b/solventmapcreator/test/resources/expected_poly_fit2.csv @@ -1,3 +1,3 @@ Order Fit Range RMSE Covariance Coefficients -1 positive 0.0154303 0.0007143 -0.0500000 1.0714286 -1 negative 0.0154303 0.0007143 -0.0500000 1.0714286 +1 positive 0.0154303350 7.142857142857E-04 -5.000000000000E-02 1.071428571429E+00 +1 negative 0.0154303350 7.142857142857E-04 -5.000000000000E-02 1.071428571429E+00 diff --git a/solventmapcreator/test/resources/water_poly_fit.csv b/solventmapcreator/test/resources/water_poly_fit.csv index 828ee4d..b44510e 100644 --- a/solventmapcreator/test/resources/water_poly_fit.csv +++ b/solventmapcreator/test/resources/water_poly_fit.csv @@ -1,3 +1,3 @@ Order Fit Range RMSE Covariance Coefficients -2 All 4.0483148 180.2773802 -3.5005663 -0.7862852 -0.2194883 -4 All 0.3415296 1.2830673 0.5181064 0.2546154 -0.3766517 -0.0206377 -0.0003760 +2 All 4.0483148029 1.802773801770E+02 -3.500566341820E+00 -7.862851828746E-01 -2.194883219214E-01 +4 All 0.3415296254 1.283067334917E+00 5.181063564258E-01 2.546154441813E-01 -3.766516658949E-01 -2.063766915193E-02 -3.760100956862E-04 diff --git a/solventmapcreator/test/resources/water_poly_fit_split.csv b/solventmapcreator/test/resources/water_poly_fit_split.csv index 39d3f9a..6c10c30 100644 --- a/solventmapcreator/test/resources/water_poly_fit_split.csv +++ b/solventmapcreator/test/resources/water_poly_fit_split.csv @@ -1,5 +1,5 @@ Order Fit Range RMSE Covariance Coefficients -2 positive 0.0000000 1.2077460 -0.8992891 -0.3969325 -2 negative 0.0188857 0.0017833 6.3245323 2.8927088 -0.0017566 -4 positive 0.0000000 1.3515748 -1.3179762 -0.1267861 -0.0151557 -0.0020380 -4 negative 0.0000000 5.0388427 2.2906276 -0.0985583 -0.0064807 -0.0001546 +2 positive 0.0000000000 1.207745983893E+00 -8.992891495144E-01 -3.969324545381E-01 +2 negative 0.0188856511 1.783339090217E-03 6.324532283352E+00 2.892708835890E+00 -1.756642146001E-03 +4 positive 0.0000000000 1.351574765483E+00 -1.317976202630E+00 -1.267861157836E-01 -1.515573075910E-02 -2.037974009318E-03 +4 negative 0.0000000000 5.038842703124E+00 2.290627584013E+00 -9.855829501750E-02 -6.480660276549E-03 -1.545673352234E-04 diff --git a/solventmapcreator/test/resources/water_poly_fit_subset.csv b/solventmapcreator/test/resources/water_poly_fit_subset.csv index e5b4904..cfddb0e 100644 --- a/solventmapcreator/test/resources/water_poly_fit_subset.csv +++ b/solventmapcreator/test/resources/water_poly_fit_subset.csv @@ -1,3 +1,3 @@ Order Fit Range RMSE Covariance Coefficients -2 All 0.0188857 0.0017833 6.3245323 2.8927088 -0.0017566 -4 All 0.0000000 5.0388427 2.2906276 -0.0985583 -0.0064807 -0.0001546 +2 All 0.0188856511 1.783339090217E-03 6.324532283352E+00 2.892708835890E+00 -1.756642146001E-03 +4 All 0.0000000000 5.038842703124E+00 2.290627584013E+00 -9.855829501750E-02 -6.480660276549E-03 -1.545673352234E-04 -- GitLab