Changeset c6ca23d in sasview for test


Ignore:
Timestamp:
Feb 18, 2014 11:47:42 AM (11 years ago)
Author:
Jeff Krzywon <jeffery.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.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:
8599f56
Parents:
7eb3aa2
Message:

Fixed the file header writing issue for cansas data files outlined in ticket #204.

Location:
test/sansdataloader/test
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • test/sansdataloader/test/isis_1_1_write_test.xml

    r75eeb425 rc6ca23d  
    11<?xml version="1.0" ?> 
    2 <SASroot version="1.1" xmlns="urn:cansas1d:1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:cansas1d:1.1 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"> 
     2<?xml-stylesheet type="text/xsl" href="cansasxml-html.xsl"?> 
     3<SASroot version="1.1" xmlns="urn:cansas1d:1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:cansas1d:1.1 http://www.cansas.org/formats/1.1/cansas1d.xsd"> 
    34        <SASentry> 
    45                <Title> 
  • test/sansdataloader/test/utest_cansas.py

    r76cd1ae rc6ca23d  
    8989        self.assertTrue(data.detector[0].distance == 575.0) 
    9090        self.assertTrue(data.detector[1].distance == 4145.02) 
     91        self.assertTrue(data.process[0].name == "Mantid generated CanSAS1D XML") 
     92         
     93     
     94    def _check_data_1_1(self, data): 
    9195        spectrum = data.trans_spectrum[0] 
    9296        self.assertTrue(len(spectrum.wavelength) == 138) 
    93         self.assertTrue(data.process[0].name == "Mantid generated CanSAS1D XML") 
    9497         
    95          
     98     
    9699    def test_cansas_xml(self): 
    97100        filename = "isis_1_1_write_test.xml" 
     
    105108        for i in range(len(dataloader)): 
    106109            self._check_data(dataloader[i]) 
     110            self._check_data_1_1(dataloader[i]) 
    107111            self._check_data(cansasreader[i]) 
     112            self._check_data_1_1(cansasreader[i]) 
    108113            reader_generic.save(filename, dataloader[i], None) 
    109114            reader2 = Reader() 
     
    161166        self.assertTrue(reader4.validateXML()) 
    162167         
     168     
     169    def test_save_cansas_v1_0(self): 
     170        filename = "isis_1_0_write_test.xml" 
     171        xmlreader = XMLreader(self.isis_1_0, self.schema_1_0) 
     172        valid = xmlreader.validateXML() 
     173        self.assertTrue(valid) 
     174        reader_generic = Loader() 
     175        dataloader = reader_generic.load(self.isis_1_0) 
     176        reader_cansas = Reader() 
     177        cansasreader = reader_cansas.read(self.isis_1_0) 
     178        for i in range(len(dataloader)): 
     179            self._check_data(dataloader[i]) 
     180            self._check_data(cansasreader[i]) 
     181            reader_generic.save(filename, dataloader[i], None) 
     182            reader2 = Reader() 
     183            return_data = reader2.read(filename) 
     184            data_new = return_data 
     185            written_data = return_data[0] 
     186            self._check_data(written_data) 
     187         
    163188 
    164189if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.