source: sasview/DataLoader/test/testloader.py @ cbe6dbe

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since cbe6dbe was bb03739, checked in by Gervaise Alina <gervyh@…>, 16 years ago

unit test added.still working on it

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[bb03739]1"""
2    Unit tests for fitting module
3"""
4import unittest
5import math
6import DataLoader
7from DataLoader.loader import  Loader
8from DataLoader.readers import TXT3_Reader,TXT2_Reader
9from DataLoader.readers import DataReader,danse_reader,tiff_reader
10
11
12
13class testFitModule(unittest.TestCase):
14    """ test fitting """
15    def testLoader(self):
16        """
17            test module Load
18        """
19        L=Loader()
20       
21        read1=TXT2_Reader.Reader()
22        read2=TXT3_Reader.Reader()
23        read3=DataReader.Reader()
24        read4=danse_reader.Reader()
25        read5=tiff_reader.Reader()
26       
27        L.setFormat('.txt',read1)
28        L.setFormat('.txt',read2)
29       
30        L.setFormat('.dat',read2)
31        L.setFormat('.dat',read1)
32       
33        L.setFormat('.ASC',read3)
34        L.setFormat('.sans',read4)
35        L.setFormat('.tif',read5)
36        L.setFormat('.jpg',read5)
37        L.setFormat('.png',read5)
38        L.setFormat('.jpeg',read5)
39        L.setFormat('.gif',read5)
40        L.setFormat('.bmp',read5)
41       
42       
43        self.assertEqual(L.loadData('empty.txt'),None) 
44        print L.loadData('test_2_columns.txt') 
45        self.assertEqual( L.getActiveReader('test_2_columns.txt'),DataLoader.readers.TXT2_Reader.Reader)
46        print L.loadData('test_3_columns.txt') 
47        self.assertEqual( L.getActiveReader('test_3_columns.txt'),DataLoader.readers.TXT3_Reader.Reader)
48        print L.loadData('test_2_columns.date')
49        self.assertEqual( L.getActiveReader('test_2_columns.date'),None) 
50        print L.loadData('MAR07232_rest.ASC') 
51        self.assertEqual( L.getActiveReader('MAR07232_rest.ASC'),DataLoader.readers.DataReader.Reader)
52        #error test
53        print L.loadData('AR07232_rest.ASC')
54        self.assertEqual( L.getActiveReader('test_3_columns.txt'),None) 
55        print L.loadData('MP_New.sans') 
56        self.assertEqual( L.getActiveReader('MP_New.sans'),DataLoader.readers.read4.Reader)
57        print L.loadData('P_New.sans') 
58        self.assertEqual( L.getActiveReader('P_New.sans'),None)
59        print L.loadData('angles_flat.png') 
60        self.assertEqual(L.getActiveReader('angles_flat.png'),DataLoader.readers.tiff_reader.Reader)
61       
62   
63   
Note: See TracBrowser for help on using the repository browser.