Skip to content

Commit

Permalink
Add test for msmbuildergh-713
Browse files Browse the repository at this point in the history
  • Loading branch information
mpharrigan committed Jun 7, 2016
1 parent 47f3118 commit e719102
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions msmbuilder/tests/test_ratematrix.py
Expand Up @@ -17,6 +17,9 @@
from msmbuilder.example_datasets import MullerPotential
from msmbuilder.example_datasets import load_doublewell
from msmbuilder.cluster import NDGrid
from msmbuilder import utils
import tempfile
import shutil

random = np.random.RandomState(0)

Expand Down Expand Up @@ -457,3 +460,18 @@ def test_doublewell():
sliding_window=sliding_window)
model.fit(assignments)
assert model.optimizer_state_.success


def test_dump():
# gh-713
sequence = [0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2]
model = ContinuousTimeMSM(verbose=False)
model.fit([sequence])

d = tempfile.mkdtemp()
try:
utils.dump(model, '{}/cmodel'.format(d))
m2 = utils.load('{}/cmodel'.format(d))
np.testing.assert_array_almost_equal(model.transmat_, m2.transmat_)
finally:
shutil.rmtree(d)
2 changes: 1 addition & 1 deletion runtests.py
Expand Up @@ -78,7 +78,7 @@ def main(argv):
if args.ipython:
commands = ['ipython']
else:
commands = ['nosetests', '--with-timer']
commands = ['nosetests', '--with-timer', '--timer-top-n', '5']

if args.verbose > 0 and not args.no_verbose:
verbosity = "-{vs}".format(vs="v" * args.verbose)
Expand Down

0 comments on commit e719102

Please sign in to comment.