Changeset 16d8e5f in sasview for DataLoader/test


Ignore:
Timestamp:
Jul 10, 2008 4:41:18 PM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
83ca047
Parents:
93f0a586
Message:

ReadInfo? module added in readers….every reader should return a read info object

Location:
DataLoader/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/test/testLoad.py

    rd3619421 r16d8e5f  
    1919from DataLoader.readers import TXT3_Reader,TXT2_Reader 
    2020from DataLoader.readers import IgorReader,danse_reader,tiff_reader 
     21  
    2122import os.path 
    2223class testLoader(unittest.TestCase): 
     
    5657         
    5758        #Testing loading a txt file of 2 columns, the only reader should be read1  
    58         xload,yload,dyload=self.L.load('test_2_columns.txt')  
     59        output=self.L.load('test_2_columns.txt')  
    5960        x=[2.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265] 
    6061        y=[0.6,3.44938, 5.82026,5.27591,5.2781,5.22531,7.47487,7.85852,10.2278] 
    6162        dx=[] 
    6263        dy=[] 
    63         self.assertEqual(len(xload),len(x)) 
    64         self.assertEqual(len(yload),len(y)) 
    65         self.assertEqual(len(dyload),0) 
     64        self.assertEqual(len(output.x),len(x)) 
     65        self.assertEqual(len(output.y),len(y)) 
     66         
    6667        for i in range(len(x)): 
    67             self.assertEqual(xload[i],x[i]) 
    68             self.assertEqual(yload[i],y[i]) 
     68            self.assertEqual(output.x[i],x[i]) 
     69            self.assertEqual(output.y[i],y[i]) 
    6970        
    7071     
    7172    def testLoad2(self): 
    7273        """Testing loading a txt file of 3 columns""" 
    73         xload,yload,dyload= self.L.load('test_3_columns.txt')  
     74        output= self.L.load('test_3_columns.txt')  
    7475        x=[0,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449]     
    7576        y=[2.83954,3.44938,5.82026,5.27591,5.2781,5.22531,7.47487] 
    7677        dx=[] 
    7778        dy=[0.6,0.676531,0.753061,0.829592,0.906122,0.982653,1.05918] 
    78         self.assertEqual(len(xload),len(x)) 
    79         self.assertEqual(len(yload),len(y)) 
    80         self.assertEqual(len(dyload),len(dy)) 
     79        self.assertEqual(len(output.x),len(x)) 
     80        self.assertEqual(len(output.y),len(y)) 
     81        self.assertEqual(len(output.dy),len(dy)) 
    8182        for i in range(len(x)): 
    82             self.assertEqual(xload[i],x[i]) 
    83             self.assertEqual(yload[i],y[i]) 
    84             self.assertEqual(dyload[i],dy[i]) 
     83            self.assertEqual(output.x[i],x[i]) 
     84            self.assertEqual(output.y[i],y[i]) 
     85            self.assertEqual(output.dy[i],dy[i]) 
    8586        
    8687     
     
    8889        """ Testing loading Igor data""" 
    8990        #tested good file.asc 
    90         Z,xmin, xmax, ymin, ymax= self.L.load('MAR07232_rest.ASC')  
    91         self.assertEqual(xmin,-0.018558945804750416) 
    92         self.assertEqual(xmax, 0.016234058202440633,) 
    93         self.assertEqual(ymin,-0.01684257151702391) 
    94         self.assertEqual(ymax,0.017950440578015116) 
     91        output= self.L.load('MAR07232_rest.ASC')  
     92        self.assertEqual(output.xmin,-0.018558945804750416) 
     93        self.assertEqual(output.xmax, 0.016234058202440633,) 
     94        self.assertEqual(output.ymin,-0.01684257151702391) 
     95        self.assertEqual(output.ymax,0.017950440578015116) 
    9596        
    9697        #tested corrupted file.asc 
     
    102103        """ Testing loading danse file""" 
    103104        #tested good file.sans 
    104         data=self.L.load('MP_New.sans') 
     105        output=self.L.load('MP_New.sans') 
    105106         
    106         self.assertEqual(data.wavelength,7.5) 
     107        self.assertEqual(output.wavelength,7.5) 
    107108         
    108109        #tested corrupted file.sans 
     
    115116    def testload5(self): 
    116117        """ Testing loading image file""" 
    117         data=self.L.load('angles_flat.png') 
    118         self.assertEqual(data.xbins ,200) 
     118        output=self.L.load('angles_flat.png') 
     119        self.assertEqual(output.xbins ,200) 
    119120         
    120121    def testload6(self): 
  • DataLoader/test/testplugings.py

    rd3619421 r16d8e5f  
    3939        self.assertEqual(self.L.__contains__('.ASC'),True) 
    4040        #Testing loading a txt file of 2 columns, the only reader should be read1  
    41         xload,yload,dyload=self.L.load('test_2_columns.txt')  
     41        output=self.L.load('test_2_columns.txt')  
    4242        x=[2.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265] 
    4343        y=[0.6,3.44938, 5.82026,5.27591,5.2781,5.22531,7.47487,7.85852,10.2278] 
    4444        dx=[] 
    4545        dy=[] 
    46         self.assertEqual(len(xload),len(x)) 
    47         self.assertEqual(len(yload),len(y)) 
    48         self.assertEqual(len(dyload),0) 
     46        self.assertEqual(len(output.x),len(x)) 
     47        self.assertEqual(len(output.y),len(y)) 
     48         
    4949        for i in range(len(x)): 
    50             self.assertEqual(xload[i],x[i]) 
    51             self.assertEqual(yload[i],y[i]) 
     50            self.assertEqual(output.x[i],x[i]) 
     51            self.assertEqual(output.y[i],y[i]) 
Note: See TracChangeset for help on using the changeset viewer.