1 # -*- coding: iso-8859-1 -*-
4 from hoomd_script
import *
8 # unit tests for analyze.msd
9 class analyze_msd_tests (unittest
.TestCase
):
12 init
.create_random(N
=100, phi_p
=0.05);
14 sorter
.set_params(grid
=8)
16 # tests basic creation of the analyzer
18 analyze
.msd(period
= 10, filename
="test.log", groups
=[group
.all()]);
21 # test variable period
22 def test_variable(self
):
23 analyze
.msd(period
= lambda n
: n
*10, filename
="test.log", groups
=[group
.all()]);
26 # test error if no groups defined
27 def test_no_gropus(self
):
28 self
.assertRaises(RuntimeError, analyze
.msd
, period
=10, filename
="test.log", groups
=[]);
31 def test_set_params(self
):
32 ana
= analyze
.msd(period
= 10, filename
="test.log", groups
=[group
.all()]);
33 ana
.set_params(delimiter
= ' ');
38 if comm
.get_rank() == 0:
39 os
.remove("test.log");
41 if __name__
== '__main__':
42 unittest
.main(argv
= ['test.py', '-v'])