Author: bugman Date: Wed Jan 2 17:23:19 2008 New Revision: 4262 URL: http://svn.gna.org/viewcvs/relax?rev=4262&view=rev Log: Added 5 unit tests for the setting of multiple model-free parameter values at once. 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=4262&r1=4261&r2=4262&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 17:23:19 2008 @@ -279,6 +279,50 @@ self.assertEqual(cdp.mol[0].res[1].spin[0].csa, -172e-6) + def test_set_mf_all_spins_diff_s2f_s2s(self): + """Set the model-free S2f and S2s parameters for all spins to different values. + + 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', 'S2s'], val=[0.7, 0.9]) + + # Test the parameters. + self.assertEqual(cdp.mol[0].res[0].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[0].spin[0].s2s, 0.9) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.9) + + + def test_set_mf_all_spins_same_s2f_s2s(self): + """Set the model-free S2f and S2s parameters for all spins to the same value. + + 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', 'S2s'], val=0.7) + + # Test the parameters. + self.assertEqual(cdp.mol[0].res[0].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[0].spin[0].s2s, 0.7) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.7) + + def test_set_mf_defaults_local_tm(self): """Set the model-free local tm parameter to the default value. @@ -479,6 +523,28 @@ self.assertEqual(cdp.mol[0].res[1].spin[0].csa, -172 * 1e-6) + def test_set_mf_defaults_s2f_s2s(self): + """Set the model-free S2f and S2s parameters to the default values. + + 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', 'S2s']) + + # Test the parameters. + self.assertEqual(cdp.mol[0].res[0].spin[0].s2f, 0.8) + self.assertEqual(cdp.mol[0].res[0].spin[0].s2s, 0.8) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.8) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.8) + + def test_set_mf_single_spin_local_tm(self): """Set the model-free local tm parameter for a single spin. @@ -677,3 +743,47 @@ # 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) + + + def test_set_mf_single_spin_diff_s2f_s2s(self): + """Set the model-free S2f and S2s parameters for a single spin to different values. + + 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', 'S2s'], val=[0.7, 0.9], spin_id=':112') + + # Test the parameters. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2f')) + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2s')) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.9) + + + def test_set_mf_single_spin_same_s2f_s2s(self): + """Set the model-free S2f and S2s parameters for a single spin to the same value. + + 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', 'S2s'], val=0.7, spin_id=':112') + + # Test the parameters. + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2f')) + self.assert_(not hasattr(cdp.mol[0].res[0].spin[0], 's2s')) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2f, 0.7) + self.assertEqual(cdp.mol[0].res[1].spin[0].s2s, 0.7)