Changeset ad92c5a in sasview for test


Ignore:
Timestamp:
Apr 18, 2017 2:56:03 PM (2 years ago)
Author:
krzywon
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:
080d88e
Parents:
da8bb53
git-author:
Jeff Krzywon <krzywon@…> (04/18/17 14:56:03)
git-committer:
krzywon <krzywon@…> (04/18/17 14:56:03)
Message:

ABS reader converted to new system.

Location:
test/sasdataloader/test
Files:
2 edited

Legend:

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

    rdd11014 rad92c5a  
    44 
    55import unittest 
    6 import math 
    76import numpy as np 
    87from sas.sascalc.dataloader.loader import Loader 
    98from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 
    10 from sas.sascalc.dataloader.data_info import Data1D 
    11   
    12 import os.path 
    13  
    14 class abs_reader(unittest.TestCase): 
     9from sas.sascalc.dataloader.readers.abs_reader import Reader as ABSReader 
     10 
     11 
     12class ABSReaderTests(unittest.TestCase): 
    1513     
    1614    def setUp(self): 
    17         from sas.sascalc.dataloader.readers.abs_reader import Reader 
    18         self.data = Reader().read("jan08002.ABS") 
     15        self.data_list = ABSReader().read("jan08002.ABS") 
     16        self.data = self.data_list[0] 
    1917         
    2018    def test_abs_checkdata(self): 
     
    3836         
    3937        self.assertEqual(self.data.detector[0].beam_center_unit, 'mm') 
    40         center_x = 114.58*5.0 
    41         center_y = 64.22*5.0 
     38        center_x = 114.58*5.08 
     39        center_y = 64.22*5.08 
    4240        self.assertEqual(self.data.detector[0].beam_center.x, center_x) 
    4341        self.assertEqual(self.data.detector[0].beam_center.y, center_y) 
     
    6159    def test_checkdata2(self): 
    6260        self.assertEqual(self.data.dy[126], 1) 
    63          
    64 class hfir_reader(unittest.TestCase): 
    65      
     61 
     62 
     63class HFIRReaderTests(unittest.TestCase): 
     64 
    6665    def setUp(self): 
    6766        self.data = Loader().load("S2-30dq.d1d") 
    68          
     67 
    6968    def test_hfir_checkdata(self): 
    7069        """ 
     
    8382        self.assertEqual(self.data.dy[1], 0.000315) 
    8483        self.assertEqual(self.data.dx[1], 0.008249) 
    85          
    86  
    87 class igor_reader(unittest.TestCase): 
     84 
     85 
     86class IgorReaderTests(unittest.TestCase): 
    8887     
    8988    def setUp(self): 
     
    134133 
    135134 
    136 class danse_reader(unittest.TestCase): 
     135class DanseReaderTests(unittest.TestCase): 
    137136     
    138137    def setUp(self): 
     
    321320                     
    322321        if _found_term1==False or _found_term2==False: 
    323             raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2)  
    324              
    325          
    326          
    327          
     322            raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 
     323 
    328324    def test_writer(self): 
    329325        from sas.sascalc.dataloader.readers.cansas_reader import Reader 
     
    339335        self.assertEqual(self.data.filename, filename) 
    340336        self._checkdata() 
    341          
     337 
    342338    def test_units(self): 
    343339        """ 
     
    350346        self.assertEqual(self.data.filename, filename) 
    351347        self._checkdata() 
    352          
     348 
    353349    def test_badunits(self): 
    354350        """ 
     
    368364        print self.data.errors 
    369365        self.assertEqual(len(self.data.errors), 1) 
    370          
    371          
     366 
    372367    def test_slits(self): 
    373368        """ 
     
    397392        self.assertEqual(self.data.run_name['1234'], 'run name') 
    398393        self.assertEqual(self.data.title, "Test title") 
    399          
    400              
     394 
    401395 
    402396if __name__ == '__main__': 
  • test/sasdataloader/test/utest_ascii.py

    rb09095a rad92c5a  
    2323        self.f5_list = self.loader.load("ascii_test_5.txt") 
    2424        self.f5 = self.f5_list[0] 
    25          
     25 
    2626    def test_checkdata(self): 
    2727        """ 
     
    3636         
    3737        self.assertEqual(self.f1.meta_data['loader'],"ASCII") 
    38          
     38 
    3939    def test_truncated_1(self): 
    4040        """ 
     
    5050        self.assertEqual(self.f2.x[0],0.002618) 
    5151        self.assertEqual(self.f2.x[4],0.02356) 
    52          
     52 
    5353    def test_truncated_2(self): 
    5454        """ 
     
    6262        self.assertEqual(self.f3.x[0],0.002618) 
    6363        self.assertEqual(self.f3.x[4],0.02356) 
    64          
     64 
    6565    def test_truncated_3(self): 
    6666        """ 
     
    7474        self.assertEqual(self.f4.x[0],0.012654) 
    7575        self.assertEqual(self.f4.x[4],0.02654) 
    76          
     76 
    7777    def test_truncated_4(self): 
    7878        """ 
     
    8484        self.assertEqual(self.f5.x[0],0.02879) 
    8585        self.assertEqual(self.f5.x[4],0.0497) 
    86          
     86 
    8787    def test_truncated_5(self): 
    8888        """ 
     
    9898        except: 
    9999            self.assertEqual(f, None) 
    100          
     100 
    101101if __name__ == '__main__': 
    102102    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.