Changeset ade1080 in sasview for test


Ignore:
Timestamp:
Apr 9, 2017 2:40:35 AM (8 years ago)
Author:
Adam Washington <adam.washington@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
10ab40e
Parents:
a79ab31
Message:

Call the sesans reader directly in unit test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/sasdataloader/test/utest_sesans.py

    ra79ab31 rade1080  
    44 
    55import unittest 
    6 from sas.sascalc.dataloader.loader import Loader 
     6from sas.sascalc.dataloader.readers.sesans_reader import Reader 
    77 
    88 
     
    1010 
    1111    def setUp(self): 
    12         self.loader = Loader() 
     12        reader = Reader() 
     13        self.loader = reader.read 
    1314 
    1415    def test_sesans_load(self): 
     
    1617            Test .SES file loading 
    1718        """ 
    18         f = self.loader.load("sesans_examples/sphere2micron.ses") 
     19        f = self.loader("sesans_examples/sphere2micron.ses") 
    1920        # self.assertEqual(f, 5) 
    2021        self.assertEqual(len(f.x), 40) 
     
    3334            Test .SES loading on a TOF dataset 
    3435        """ 
    35         f = self.loader.load("sesans_examples/sphere_isis.ses") 
     36        f = self.loader("sesans_examples/sphere_isis.ses") 
    3637        self.assertEqual(len(f.x), 57) 
    3738        self.assertEqual(f.x[-1], 19303.4) 
     
    4647            Test .SES loading on a TOF dataset 
    4748        """ 
    48         f = self.loader.load("sesans_examples/sesans_no_data.ses") 
    49         self.assertEqual(len(f.x), 57) 
    50         self.assertEqual(f.x[-1], 19303.4) 
    51         self.assertEqual(f.source.wavelength[-1], 13.893668) 
    52         self.assertEqual(f.source.wavelength[0], 1.612452) 
    53         self.assertEqual(f.sample.yacceptance, (0.09, "radians")) 
    54         self.assertEqual(f.sample.zacceptance, (0.09, "radians")) 
    55         self.assertEqual(f.sample.thickness, 0.2) 
     49        self.assertRaises( 
     50            RuntimeError, 
     51            self.loader, 
     52            "sesans_examples/sesans_no_data.ses") 
    5653 
    5754if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.