From 9a49244fe04961f7d9546b69af80d0d71608be61 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Mon, 23 Jan 2017 04:27:36 +0530 Subject: [PATCH 01/11] Added exception and unittest for function dist_mat_to_vec of analysis/psa.py (part of #597) --- .../MDAnalysisTests/analysis/test_psa.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index e29f250ec9f..4ac09791e14 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -93,6 +93,16 @@ def test_dendrogram_produced(self): err_msg = "Dendrogram dictionary object was not produced" assert_(type(self.plot_data[1]) is dict, err_msg) + def test_dist_mat_to_vec_i_less_j(self): + """Test that distance is correct if i < j""" + err_msg = "dist_mat_to_vec function returning wrong values" + assert_(PSA.dist_mat_to_vec(5, 3, 4) is 9, err_msg) + + def test_dist_mat_to_vec_i_greater_j(self): + """Test that distance is correct if i < j""" + err_msg = "dist_mat_to_vec function returning wrong values" + assert_(PSA.dist_mat_to_vec(5, 4, 3) is 9, err_msg) + class TestPSAExceptions(TestCase): '''Tests for exceptions that should be raised @@ -115,6 +125,21 @@ def test_get_coord_axes_bad_dims(self): with self.assertRaises(ValueError): PSA.get_coord_axes(np.zeros((5,5,5,5))) + def test_dist_mat_to_vec_func_out_of_bounds(self): + """Test that ValueError is raised when i or j is + out of bounds of N""" + + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, 6, 6) + + def test_dist_mat_to_vec_func_bad_integers(self): + """Test that ValueError is raised when i or j are + not Integers""" + + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, '6', '7') + + class _BaseHausdorffDistance(TestCase): '''Base Class setup and unit tests for various Hausdorff distance From 3af71be906c365872becf7b8eba07f97baa8e364 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Mon, 23 Jan 2017 16:43:04 +0530 Subject: [PATCH 02/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- testsuite/MDAnalysisTests/analysis/test_psa.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 4ac09791e14..5ec0f74028d 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -26,7 +26,7 @@ from numpy.testing import (TestCase, dec, assert_array_less, assert_array_almost_equal, assert_, - assert_almost_equal) + assert_almost_equal, assert_equal) import numpy as np from MDAnalysisTests.datafiles import PSF, DCD, DCD2 @@ -94,15 +94,14 @@ def test_dendrogram_produced(self): assert_(type(self.plot_data[1]) is dict, err_msg) def test_dist_mat_to_vec_i_less_j(self): - """Test that distance is correct if i < j""" + """Test the index of corresponding distance vector is correct if i < j""" err_msg = "dist_mat_to_vec function returning wrong values" - assert_(PSA.dist_mat_to_vec(5, 3, 4) is 9, err_msg) + assert_equal(PSA.dist_mat_to_vec(5, 3, 4), 9, err_msg) def test_dist_mat_to_vec_i_greater_j(self): - """Test that distance is correct if i < j""" + """Test the index of corresponding distance vector is correct if i > j""" err_msg = "dist_mat_to_vec function returning wrong values" - assert_(PSA.dist_mat_to_vec(5, 4, 3) is 9, err_msg) - + assert_equal(PSA.dist_mat_to_vec(5, 4, 3), 9, err_msg) class TestPSAExceptions(TestCase): '''Tests for exceptions that should be raised @@ -126,10 +125,12 @@ def test_get_coord_axes_bad_dims(self): PSA.get_coord_axes(np.zeros((5,5,5,5))) def test_dist_mat_to_vec_func_out_of_bounds(self): - """Test that ValueError is raised when i or j is + """Test that ValueError is raised when i or j or both are out of bounds of N""" with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, 6, 4) + PSA.dist_mat_to_vec(5, 4, 6) PSA.dist_mat_to_vec(5, 6, 6) def test_dist_mat_to_vec_func_bad_integers(self): @@ -138,7 +139,7 @@ def test_dist_mat_to_vec_func_bad_integers(self): with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, '6', '7') - + PSA.dist_mat_to_vec(5, float(6), 7) class _BaseHausdorffDistance(TestCase): '''Base Class setup and unit tests From bf8765b5750d685fdd35855184a6b7157ee83bae Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Mon, 23 Jan 2017 22:21:49 +0530 Subject: [PATCH 03/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- testsuite/MDAnalysisTests/analysis/test_psa.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 5ec0f74028d..24cefdb917a 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -117,9 +117,9 @@ def test_get_path_metric_func_bad_key(self): self.fail('KeyError should be caught') def test_get_coord_axes_bad_dims(self): - '''Test that ValueError is raised when + """Test that ValueError is raised when numpy array with incorrect dimensions - is fed to get_coord_axes().''' + is fed to get_coord_axes().""" with self.assertRaises(ValueError): PSA.get_coord_axes(np.zeros((5,5,5,5))) @@ -128,9 +128,16 @@ def test_dist_mat_to_vec_func_out_of_bounds(self): """Test that ValueError is raised when i or j or both are out of bounds of N""" + # Check if i is out of bounds of N with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 6, 4) + + # Check if j is out of bounds of N + with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 4, 6) + + # Check if both i and j are out of bounds of N + with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 6, 6) def test_dist_mat_to_vec_func_bad_integers(self): @@ -139,6 +146,8 @@ def test_dist_mat_to_vec_func_bad_integers(self): with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, '6', '7') + + with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, float(6), 7) class _BaseHausdorffDistance(TestCase): From cda6c5767dfa78fe88243c562b23afb28cf4f541 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Mon, 23 Jan 2017 22:35:13 +0530 Subject: [PATCH 04/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- testsuite/MDAnalysisTests/analysis/test_psa.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 24cefdb917a..64443a797ba 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -138,7 +138,13 @@ def test_dist_mat_to_vec_func_out_of_bounds(self): # Check if both i and j are out of bounds of N with self.assertRaises(ValueError): - PSA.dist_mat_to_vec(5, 6, 6) + PSA.dist_mat_to_vec(5, 6, 7) + + def test_dist_mat_to_vec_func_i_equals_j(self): + """Test that ValueError is raised when i == j""" + + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, 4, 4) def test_dist_mat_to_vec_func_bad_integers(self): """Test that ValueError is raised when i or j are From dcc6168ac578a8a76e62cf87ff66390f536872a6 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Sun, 29 Jan 2017 02:23:20 +0530 Subject: [PATCH 05/11] Adds validation for dist_mat_to_vec function inputs --- package/MDAnalysis/analysis/psa.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index 1f697eb0660..6db5120b4b3 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -573,6 +573,10 @@ def dist_mat_to_vec(N, i, j): :Returns: int, index (of the matrix element) in the corresponding distance vector """ + try: + validate_dist_mat_to_vec_inputs(N, i, j) + except Exception as E: + raise E if i > N or j > N: err_str = "Matrix indices are out of range; i and j must be less than" \ + " N = {0:d}".format(N) @@ -591,6 +595,30 @@ def dist_mat_to_vec(N, i, j): raise ValueError(err_str) +def validate_dist_mat_to_vec_inputs(N, i, j): + """ + Validate the inputs of the function dist_mat_to_vec else raise an exception + :param N: int + :param i: int + :param j: int + :return: null + """ + + # Validating if the inputs are integer + try: + NValue = int(N) + iValue = int(i) + jValue = int(j) + except ValueError: + raise ValueError + + # Check if the inputs are not out of bounds + if N-1 > i > 0 and N >= 2 and i < j < N: + pass + else: + raise ValueError + + class Path(object): """Pre-process a :class:`MDAnalysis.Universe` object: (1) fit the trajectory to a reference structure, (2) convert fitted time series to a From 3943ddc4480ae6d9bb9fc15f0042832e6bef93f1 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Wed, 1 Feb 2017 02:33:43 +0530 Subject: [PATCH 06/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- package/MDAnalysis/analysis/psa.py | 36 +++++-------------- .../MDAnalysisTests/analysis/test_psa.py | 17 ++++++++- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index 6db5120b4b3..baf6756b701 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -573,10 +573,14 @@ def dist_mat_to_vec(N, i, j): :Returns: int, index (of the matrix element) in the corresponding distance vector """ - try: - validate_dist_mat_to_vec_inputs(N, i, j) - except Exception as E: - raise E + + if not (isinstance(N, int) or isinstance(i, int) or isinstance(j, int)): + raise ValueError("N, i, j all must be of type int") + + if i < 0 or j < 0 or N < 2: + error_str = "Matrix indices are invalid; i and j must be greater than 0 and N must be greater the 2" + raise ValueError(error_str) + if i > N or j > N: err_str = "Matrix indices are out of range; i and j must be less than" \ + " N = {0:d}".format(N) @@ -595,30 +599,6 @@ def dist_mat_to_vec(N, i, j): raise ValueError(err_str) -def validate_dist_mat_to_vec_inputs(N, i, j): - """ - Validate the inputs of the function dist_mat_to_vec else raise an exception - :param N: int - :param i: int - :param j: int - :return: null - """ - - # Validating if the inputs are integer - try: - NValue = int(N) - iValue = int(i) - jValue = int(j) - except ValueError: - raise ValueError - - # Check if the inputs are not out of bounds - if N-1 > i > 0 and N >= 2 and i < j < N: - pass - else: - raise ValueError - - class Path(object): """Pre-process a :class:`MDAnalysis.Universe` object: (1) fit the trajectory to a reference structure, (2) convert fitted time series to a diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 64443a797ba..9c6e03d3a2f 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -140,12 +140,27 @@ def test_dist_mat_to_vec_func_out_of_bounds(self): with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 6, 7) + # Check if i is negative + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, -1, 2) + + # Check if i is negative + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(5, 1, -2) + + # Check if N is less than 2 + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(1, 0, 0) + def test_dist_mat_to_vec_func_i_equals_j(self): - """Test that ValueError is raised when i == j""" + """Test that ValueError is raised when i == j or i,j == N""" with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 4, 4) + with self.assertRaises(ValueError): + PSA.dist_mat_to_vec(4, 6, 4) + def test_dist_mat_to_vec_func_bad_integers(self): """Test that ValueError is raised when i or j are not Integers""" From f12458e9df61c6721b78d8725d7e1270a203eac5 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Wed, 1 Feb 2017 02:37:10 +0530 Subject: [PATCH 07/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- package/MDAnalysis/analysis/psa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index baf6756b701..aaa57adabb8 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -591,7 +591,7 @@ def dist_mat_to_vec(N, i, j): warn_str = "Column index entered (j = {:d} is smaller than row index" \ + " (i = {:d}). Using symmetric element in upper triangle of" \ + " distance matrix instead: i --> j, j --> i" - print(warn_str) + warnings.warn(war_str.format(j, i)) return (N*j) + i - (j+2)*(j+1)/2 else: err_str = "Error in processing matrix indices; i and j must be integers"\ From ece534a23614cb135d6b2d2cea6c4f2d77611a79 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Thu, 2 Feb 2017 17:49:25 +0530 Subject: [PATCH 08/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- package/AUTHORS | 1 + package/CHANGELOG | 3 ++- package/MDAnalysis/analysis/psa.py | 5 +++-- testsuite/AUTHORS | 2 +- testsuite/CHANGELOG | 2 +- testsuite/MDAnalysisTests/analysis/test_psa.py | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package/AUTHORS b/package/AUTHORS index 1313548bda9..43e64e745dc 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -81,6 +81,7 @@ Chronological list of authors - Shantanu Srivastava 2017 - Utkarsh Bansal + - Vedant Rathore External code ------------- diff --git a/package/CHANGELOG b/package/CHANGELOG index f75f30545d5..79c5866ea6a 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -15,7 +15,7 @@ The rules for this file: ------------------------------------------------------------------------------ ??/??/16 kain88-de, fiona-naughton, richardjgowers, tyler.je.reddy, jdetle euhruska, orbeckst, rbrtdlg, jbarnoud, wouterboomsma, shanmbic, - dotsdl, manuel.nuno.melo, utkbansal + dotsdl, manuel.nuno.melo, utkbansal, vedantrathore * 0.16.0 @@ -61,6 +61,7 @@ Enhancements * Added groupby method to Group objects. (PR #1112) Fixes + * Argument validation of dist_mat_to_vec is fixed (#597 PR #1183) * Give correct error when the topology file format is not recognized (Issue #982) * Give correct error when file doesn't exist/ has bad permissions (Issue #981) * Improvement of analysis/waterdynamics module (Issue #935) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index aaa57adabb8..44f9ea92d25 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -212,6 +212,7 @@ from six.moves import range, cPickle import numpy as np +import warnings import MDAnalysis import MDAnalysis.analysis.align @@ -581,7 +582,7 @@ def dist_mat_to_vec(N, i, j): error_str = "Matrix indices are invalid; i and j must be greater than 0 and N must be greater the 2" raise ValueError(error_str) - if i > N or j > N: + if (j > i and (i > N - 1 or j > N)) or (j < i and (i > N or j > N - 1)): err_str = "Matrix indices are out of range; i and j must be less than" \ + " N = {0:d}".format(N) raise ValueError(err_str) @@ -591,7 +592,7 @@ def dist_mat_to_vec(N, i, j): warn_str = "Column index entered (j = {:d} is smaller than row index" \ + " (i = {:d}). Using symmetric element in upper triangle of" \ + " distance matrix instead: i --> j, j --> i" - warnings.warn(war_str.format(j, i)) + warnings.warn(warn_str.format(j, i)) return (N*j) + i - (j+2)*(j+1)/2 else: err_str = "Error in processing matrix indices; i and j must be integers"\ diff --git a/testsuite/AUTHORS b/testsuite/AUTHORS index 6745b837268..5dc674d5986 100644 --- a/testsuite/AUTHORS +++ b/testsuite/AUTHORS @@ -73,7 +73,7 @@ Chronological list of authors 2017 - Utkarsh Bansal - + - Vedant Rathore External code ------------- diff --git a/testsuite/CHANGELOG b/testsuite/CHANGELOG index 77800f0b95f..a5f18e496e3 100644 --- a/testsuite/CHANGELOG +++ b/testsuite/CHANGELOG @@ -14,7 +14,7 @@ and https://github.com/MDAnalysis/mdanalysis/wiki/UnitTests ------------------------------------------------------------------------------ ??/??/16 jbarnoud, orbeckst, fiona-naughton, manuel.nuno.melo, richardjgowers - tyler.je.reddy, utkbansal + tyler.je.reddy, utkbansal, vedantrathore * 0.16 - added two unit tests for MDAnalysis.analysis.polymer diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 9c6e03d3a2f..45ee8da6e27 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -144,7 +144,7 @@ def test_dist_mat_to_vec_func_out_of_bounds(self): with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, -1, 2) - # Check if i is negative + # Check if j is negative with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, 1, -2) From 36acf58aea7020823af2b46996ca054f17b09aca Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Fri, 3 Feb 2017 14:28:03 +0530 Subject: [PATCH 09/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- package/MDAnalysis/analysis/psa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index 44f9ea92d25..c0995e2024e 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -212,7 +212,7 @@ from six.moves import range, cPickle import numpy as np -import warnings +import warnings,numbers import MDAnalysis import MDAnalysis.analysis.align @@ -575,7 +575,7 @@ def dist_mat_to_vec(N, i, j): int, index (of the matrix element) in the corresponding distance vector """ - if not (isinstance(N, int) or isinstance(i, int) or isinstance(j, int)): + if not (isinstance(N, numbers.Integral) or isinstance(i, numbers.Integral) or isinstance(j, numbers.Integral)): raise ValueError("N, i, j all must be of type int") if i < 0 or j < 0 or N < 2: From 376b0b1798fb9c2002d7278bf907cd2b59a493e6 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Fri, 3 Feb 2017 16:36:56 +0530 Subject: [PATCH 10/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- package/MDAnalysis/analysis/psa.py | 3 ++- testsuite/MDAnalysisTests/analysis/test_psa.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package/MDAnalysis/analysis/psa.py b/package/MDAnalysis/analysis/psa.py index c0995e2024e..4850c24cf74 100644 --- a/package/MDAnalysis/analysis/psa.py +++ b/package/MDAnalysis/analysis/psa.py @@ -576,7 +576,8 @@ def dist_mat_to_vec(N, i, j): """ if not (isinstance(N, numbers.Integral) or isinstance(i, numbers.Integral) or isinstance(j, numbers.Integral)): - raise ValueError("N, i, j all must be of type int") + err_str = "N, i, j all must be of type int" + raise ValueError(err_str) if i < 0 or j < 0 or N < 2: error_str = "Matrix indices are invalid; i and j must be greater than 0 and N must be greater the 2" diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index 45ee8da6e27..a5cc3df74a9 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -103,6 +103,16 @@ def test_dist_mat_to_vec_i_greater_j(self): err_msg = "dist_mat_to_vec function returning wrong values" assert_equal(PSA.dist_mat_to_vec(5, 4, 3), 9, err_msg) + def test_dist_mat_to_vec_input_numpy_integer_32(self): + """Test whether inputs are supported as numpy integers rather than normal Integers""" + err_msg = "dist_mat_to_vec function returning wrong values" + assert_equal(PSA.dist_mat_to_vec(np.int32(5), np.int32(3), np.int32(4)), err_msg) + + def test_dist_mat_to_vec_input_numpy_integer_16(self): + """Test whether inputs are supported as numpy integers rather than normal Integers""" + err_msg = "dist_mat_to_vec function returning wrong values" + assert_equal(PSA.dist_mat_to_vec(np.int16(5), np.int16(3), np.int16(4)), err_msg) + class TestPSAExceptions(TestCase): '''Tests for exceptions that should be raised or caught by code in the psa module.''' @@ -171,6 +181,7 @@ def test_dist_mat_to_vec_func_bad_integers(self): with self.assertRaises(ValueError): PSA.dist_mat_to_vec(5, float(6), 7) + class _BaseHausdorffDistance(TestCase): '''Base Class setup and unit tests for various Hausdorff distance From bd940072418db5a90968a6720d9597514168c407 Mon Sep 17 00:00:00 2001 From: Vedant Rathore Date: Sat, 4 Feb 2017 00:57:19 +0530 Subject: [PATCH 11/11] Added exception and unittest for dist_mat_to_vec of analysis/psa.py (Part of #597) --- testsuite/MDAnalysisTests/analysis/test_psa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/MDAnalysisTests/analysis/test_psa.py b/testsuite/MDAnalysisTests/analysis/test_psa.py index a5cc3df74a9..010b724fafb 100644 --- a/testsuite/MDAnalysisTests/analysis/test_psa.py +++ b/testsuite/MDAnalysisTests/analysis/test_psa.py @@ -106,12 +106,12 @@ def test_dist_mat_to_vec_i_greater_j(self): def test_dist_mat_to_vec_input_numpy_integer_32(self): """Test whether inputs are supported as numpy integers rather than normal Integers""" err_msg = "dist_mat_to_vec function returning wrong values" - assert_equal(PSA.dist_mat_to_vec(np.int32(5), np.int32(3), np.int32(4)), err_msg) + assert_equal(PSA.dist_mat_to_vec(np.int32(5), np.int32(3), np.int32(4)), np.int32(9), err_msg) def test_dist_mat_to_vec_input_numpy_integer_16(self): """Test whether inputs are supported as numpy integers rather than normal Integers""" err_msg = "dist_mat_to_vec function returning wrong values" - assert_equal(PSA.dist_mat_to_vec(np.int16(5), np.int16(3), np.int16(4)), err_msg) + assert_equal(PSA.dist_mat_to_vec(np.int16(5), np.int16(3), np.int16(4)), np.int16(9), err_msg) class TestPSAExceptions(TestCase): '''Tests for exceptions that should be raised