source: sasview/sansmodels/src/sans/models/test/utest_state.py @ 44fa116

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 44fa116 was d67fc8d, checked in by Mathieu Doucet <doucetm@…>, 15 years ago

sansmodels: state unit test

  • Property mode set to 100644
File size: 757 bytes
Line 
1import unittest
2
3from sans.models.SphereModel import SphereModel
4
5class TestSphere(unittest.TestCase):
6    def setUp(self):
7        self.sphere = SphereModel()
8       
9    def test_state_IO(self):
10        """
11            Check that a state oject is independent from the model object it
12            was generated with
13        """
14        self.sphere.setParam('radius', 44.0)
15        state = self.sphere.__getstate__()
16       
17        sphere_copy = SphereModel()
18        sphere_copy.__setstate__(state)
19       
20        self.assertEqual(sphere_copy.getParam('radius'), 44)
21       
22        self.sphere.setParam('radius', 33.0)
23       
24        self.assertEqual(sphere_copy.getParam('radius'), 44)
25       
26   
27if __name__ == '__main__':
28    unittest.main()
Note: See TracBrowser for help on using the repository browser.