Changeset 248ff73 in sasview for test


Ignore:
Timestamp:
Aug 1, 2017 11:36:38 AM (7 years ago)
Author:
lewis
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:
5a8cdbb
Parents:
b2c28a5
Message:

Ensure unit tests pass

utest_averaging still fails as it relies on loading in an Igor 2D file,
which is no longer possible

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/fileconverter/test/utest_nxcansas_writer.py

    rc476457 r248ff73  
    11from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 
    2 from sas.sascalc.dataloader.readers.cansas_reader import Reader as XMLReader 
    3 from sas.sascalc.dataloader.readers.red2d_reader import Reader as DATReader 
    4 from sas.sascalc.dataloader.readers.cansas_reader_HDF5 import Reader as HDF5Reader 
     2from sas.sascalc.dataloader.loader import Loader 
    53 
    64import os 
     
    1412 
    1513    def setUp(self): 
     14        self.loader = Loader() 
    1615        self.writer = NXcanSASWriter() 
    1716        self.read_file_1d = "cansas1d.xml" 
     
    1918        self.read_file_2d = "exp18_14_igor_2dqxqy.dat" 
    2019        self.write_file_2d = "export2d.h5" 
    21         self.hdf5_reader = HDF5Reader() 
    2220 
    23         xml_reader = XMLReader() 
    24         self.data_1d = xml_reader.read(self.read_file_1d)[0] 
     21        self.data_1d = self.loader.load(self.read_file_1d)[0] 
    2522 
    26         dat_reader = DATReader() 
    27         self.data_2d = dat_reader.read(self.read_file_2d) 
     23        self.data_2d = self.loader.load(self.read_file_2d)[0] 
    2824        self.data_2d.detector[0].name = '' 
    2925        self.data_2d.source.radiation = 'neutron' 
     
    3127    def test_write_1d(self): 
    3228        self.writer.write([self.data_1d], self.write_file_1d) 
    33         data = self.hdf5_reader.read(self.write_file_1d) 
     29        data = self.loader.load(self.write_file_1d) 
    3430        self.assertTrue(len(data) == 1) 
    3531        data = data[0] 
     
    4137    def test_write_2d(self): 
    4238        self.writer.write([self.data_2d], self.write_file_2d) 
    43         data = self.hdf5_reader.read(self.write_file_2d) 
     39        data = self.loader.load(self.write_file_2d) 
    4440        self.assertTrue(len(data) == 1) 
    4541        data = data[0] 
  • test/sasdataloader/test/utest_red2d_reader.py

    r959eb01 r248ff73  
    77import unittest 
    88from sas.sascalc.dataloader.loader import  Loader 
    9   
     9 
    1010import os.path 
    1111 
    1212class abs_reader(unittest.TestCase): 
    13      
     13 
    1414    def setUp(self): 
    1515        self.loader = Loader() 
    16          
     16 
    1717    def test_checkdata(self): 
    1818        """ 
    1919            Test .DAT file loaded as IGOR/DAT 2D Q_map 
    2020        """ 
    21         f = self.loader.load("exp18_14_igor_2dqxqy.dat") 
     21        f = self.loader.load("exp18_14_igor_2dqxqy.dat")[0] 
    2222        # The length of the data is 10 
    2323        self.assertEqual(len(f.qx_data),  36864) 
     
    2626        self.assertEqual(f.Q_unit, '1/A') 
    2727        self.assertEqual(f.I_unit, '1/cm') 
    28          
     28 
    2929        self.assertEqual(f.meta_data['loader'],"IGOR/DAT 2D Q_map") 
    30          
    31          
     30 
     31 
    3232if __name__ == '__main__': 
    3333    unittest.main() 
    34     
Note: See TracChangeset for help on using the changeset viewer.