markovmodel / variational

Basis sets, estimators and solvers for the variational approach of conformation dynamics. NOTE: the code has been merged with PyEMMA and is maintained there.
10 stars 5 forks source link

Exception: Number of basis functions is incorrect.Got 10, expected 11. #19

Closed marscher closed 9 years ago

marscher commented 9 years ago

Tests are currently failing on Python 2.7 with

ERROR: test_WrongDimension (variational.estimators.tests.TestEstimator.TestEstimator)
---------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/_test/lib/python2.7/site-packages/variational-0+untagged.46.gecb3aec-py2.7-linux-x86_64.egg/variational/estimators/tests/TestEstimator.py", line 42, in test_WrongDimension
    self.assertRaises(Exception, self.estimator.add(self.traj0[:,:-1]))
  File "/home/travis/miniconda/envs/_test/lib/python2.7/site-packages/variational-0+untagged.46.gecb3aec-py2.7-linux-x86_64.egg/variational/estimators/lagged_correlation.py", line 40, in add
    self.output_dimension))
Exception: Number of basis functions is incorrect.Got 10, expected 11.
fnueske commented 9 years ago

Hey Martin,

can you briefly explain to me how I can invoke these tests in order to understand what is happening here? Thanks!

Feliks

Am 19.11.15 um 14:24 schrieb Martin K. Scherer:

Tests are currently failing on Python 2.7 with

|ERROR: test_WrongDimension

(variational.estimators.tests.TestEstimator.TestEstimator)

Traceback (most recent call last): File "/home/travis/miniconda/envs/_test/lib/python2.7/site-packages/variational-0+untagged.46.gecb3aec-py2.7-linux-x86_64.egg/variational/estimators/tests/TestEstimator.py", line 42, in test_WrongDimension self.assertRaises(Exception, self.estimator.add(self.traj0[:,:-1])) File "/home/travis/miniconda/envs/_test/lib/python2.7/site-packages/variational-0+untagged.46.gecb3aec-py2.7-linux-x86_64.egg/variational/estimators/lagged_correlation.py", line 40, in add self.output_dimension)) Exception: Number of basis functions is incorrect.Got 10, expected 11. |

— Reply to this email directly or view it on GitHub https://github.com/markovmodel/variational/issues/19.

marscher commented 9 years ago

simply invoke the test script with python or run the all the tests (recommended to avoid side effects in other modules):

python variational/estimators/tests/TestEstimator.py
# or
nosetests variational
fnueske commented 9 years ago

This is strange, because I think what happens is exactly what is supposed to happen. The method

self.estimator.add()

raises a standard exception, and this should be tested. Still,

assertRaises(Exception, self.estimator.add(self.traj0[:,:-1]))

causes an error. Martin, am I doing something wrong with the usage of assertRaises?

Am 19.11.15 um 14:58 schrieb Martin K. Scherer:

simply invoke the test script with python or run the all the tests (recommended to avoid side effects in other modules):

|python variational/estimators/tests/TestEstimator.py # or nosetests variational |

— Reply to this email directly or view it on GitHub https://github.com/markovmodel/variational/issues/19#issuecomment-158063915.

marscher commented 9 years ago

The only usage pattern of assertRaises I've used so far is within context managers:

 with self.assertRaises(ExceptionType):
           function_which_should_raise("with", "this", "arguments")

This way the exception is being catched by the with block, otherwise it's not.

marscher commented 9 years ago

@fnueske I've fixed it in #20

fnueske commented 9 years ago

Thank you! I didn't know this was the right usage!