Ignore:
Timestamp:
Aug 1, 2017 11:36:38 AM (3 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

File:
1 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] 
Note: See TracChangeset for help on using the changeset viewer.