source: sasview/sanscalculator/test/utest_sans_gen.py @ 4726f7c

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 4726f7c was d7b6913, checked in by Jae Cho <jhjcho@…>, 12 years ago

sans gen utest

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[d7b6913]1"""
2Unit tests for the sans_gen
3"""
4import warnings
5warnings.simplefilter("ignore")
6
7import unittest
8from sans.calculator import sans_gen
9 
10import os.path
11
12class sans_gen_test(unittest.TestCase):
13   
14    def setUp(self):
15        self.model = sans_gen.GenSAS()
16        self.sldloader = sans_gen.SLDReader()
17        self.pdbloader = sans_gen.PDBReader()
18        self.omfloader = sans_gen.OMFReader()
19       
20    def test_sldreader(self):
21        """
22        Test .sld file loaded
23        """
24        f = self.sldloader.read("sld_file.sld")
25        self.assertEqual(f.pos_x[0], -40.5)
26        self.assertEqual(f.pos_y[0], -13.5)
27        self.assertEqual(f.pos_z[0], -13.5)
28       
29    def test_pdbreader(self):
30        """
31        Test .pdb file loaded
32        """
33        f = self.pdbloader.read("c60.pdb")
34        self.assertEqual(f.pos_x[0], -0.733)
35        self.assertEqual(f.pos_y[0], -1.008)
36        self.assertEqual(f.pos_z[0], 3.326)
37       
38    def test_omfreader(self):
39        """
40        Test .omf file loaded
41        """
42        f = self.omfloader.read("A_Raw_Example-1.omf")
43        self.assertEqual(f.mx[0], 0)
44        self.assertEqual(f.my[0], 0)
45        self.assertEqual(f.mz[0], 0)
46       
47if __name__ == '__main__':
48    unittest.main()
49   
Note: See TracBrowser for help on using the repository browser.