Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed May 17, 2016
1 parent a902cdc commit ab4ccd7
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions pyemma/msm/tests/test_msm_lowlevel_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ def test_analysis(self):
analysis.is_transition_matrix

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIn('analysis', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.analysis.is_transition_matrix
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assert
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)
self.assertIn('analysis', cm[0].message.args[0])

@unittest.skipIf(sys.version_info.major == 2, "not on py2")
def test_warn_was_called(self):
shim_mod = sys.modules['pyemma.msm.analysis']
with mock.patch.object(shim_mod, '_warn') as m:
Expand All @@ -53,14 +52,16 @@ def test_estimation(self):
estimation.count_matrix

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('estimation', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.estimation.count_matrix
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('estimation', cm[0].message.args[0])

def test_generation(self):
Expand All @@ -70,14 +71,16 @@ def test_generation(self):
generation.generate_traj

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('generation', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.generation.generate_traj
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('generation', cm[0].message.args[0])

def test_dtraj(self):
Expand All @@ -87,14 +90,16 @@ def test_dtraj(self):
dtraj.load_discrete_trajectory

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('dtraj', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.dtraj.load_discrete_trajectory
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('dtraj', cm[0].message.args[0])

def test_io(self):
Expand All @@ -104,14 +109,16 @@ def test_io(self):
dtraj.load_discrete_trajectory

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('dtraj', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.dtraj.load_discrete_trajectory
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('dtraj', cm[0].message.args[0])

def test_flux(self):
Expand All @@ -121,12 +128,14 @@ def test_flux(self):
flux.total_flux

self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('flux', cm[0].message.args[0])

with warnings.catch_warnings(record=True) as cm:
warnings.simplefilter("always")
pyemma.msm.flux.total_flux
self.assertEqual(len(cm), 1)
self.assertTrue(isinstance(cm[0], PyEMMA_DeprecationWarning))
self.assertIsInstance(cm[0].message, PyEMMA_DeprecationWarning)

self.assertIn('flux', cm[0].message.args[0])

0 comments on commit ab4ccd7

Please sign in to comment.