Author: bugman Date: Wed Jan 2 16:59:36 2008 New Revision: 4258 URL: http://svn.gna.org/viewcvs/relax?rev=4258&view=rev Log: Added 10 unit tests for the setting of spin specific model-free parameter values. Modified: 1.3/test_suite/unit_tests/value_testing_base.py Modified: 1.3/test_suite/unit_tests/value_testing_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/value_testing_base.py?rev=4258&r1=4257&r2=4258&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/value_testing_base.py (original) +++ 1.3/test_suite/unit_tests/value_testing_base.py Wed Jan 2 16:59:36 2008 @@ -47,9 +47,6 @@ # Set up some spins. self.set_up_spins(pipe_name='mf') - - # Set the current data pipe to 'mf'. - relax_data_store.current_pipe = 'mf' def tearDown(self): @@ -80,3 +77,203 @@ pipe.mol[0].res.add_item('Trp', 2) pipe.mol[0].res[1].spin[0].num = 112 pipe.mol[0].res[1].spin[0].name = 'NH' + + + def test_set_mf_single_spin_local_tm(self): + """Set the model-free local tm parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='local tm', val=1e-8, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'local_tm') + self.assertEqual(cdp.mol[0].res[1].spin[0].local_tm, 1e-8) + + + def test_set_mf_single_spin_s2(self): + """Set the model-free S2 parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='S2', val=0.8, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2') + self.assertEqual(cdp.mol[0].res[1].spin[0].s2, 0.8) + + + def test_set_mf_single_spin_s2f(self): + """Set the model-free S2f parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='S2f', val=0.45, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2f') + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.45) + + + def test_set_mf_single_spin_s2s(self): + """Set the model-free S2s parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='S2s', val=0.1, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2s') + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.1) + + + def test_set_mf_single_spin_te(self): + """Set the model-free te parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='te', val=12.5e-12, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'te') + self.assertEqual(cdp.mol[0].res[1].spin[0].te, 12.5e-12) + + + def test_set_mf_single_spin_tf(self): + """Set the model-free tf parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='tf', val=20.1e-12, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'tf') + self.assertEqual(cdp.mol[0].res[1].spin[0].tf, 20.1e-12) + + + def test_set_mf_single_spin_ts(self): + """Set the model-free ts parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='ts', val=1.23e-9, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'ts') + self.assertEqual(cdp.mol[0].res[1].spin[0].ts, 1.23e-9) + + + def test_set_mf_single_spin_rex(self): + """Set the model-free Rex parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='Rex', val=2.34, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'rex') + self.assertEqual(cdp.mol[0].res[1].spin[0].rex, 2.34) + + + def test_set_mf_single_spin_r(self): + """Set the model-free bond length parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='Bond length', val=1.02e-10, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'r') + self.assertEqual(cdp.mol[0].res[1].spin[0].r, 1.02e-10) + + + def test_set_mf_single_spin_csa(self): + """Set the model-free CSA parameter for a single spin. + + The functions tested are both generic_fns.value.set() and prompt.value.set(). + """ + + # Set the current data pipe to 'mf'. + relax_data_store.current_pipe = 'mf' + + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Set the parameter. + self.value_fns.set(param='CSA', val=-172e-6, spin_id=':112') + + # Test the parameter. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 'csa') + self.assertEqual(cdp.mol[0].res[1].spin[0].csa, -172e-6)