Changeset 2e3b055 in sasview for test


Ignore:
Timestamp:
Apr 16, 2014 1:50:31 PM (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:
b8de7fb
Parents:
d4117ccb
Message:

Transitioned from minidom to lxml for writing xml for neater output. XMLreader now has helper methods used to read and write xml data. Methods were taken from cansasReader to separate generic XML functions from cansas specific ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/sansdataloader/test/utest_cansas.py

    rea67541 r2e3b055  
    9090        self.assertTrue(data.detector[1].distance == 4145.02) 
    9191        self.assertTrue(data.process[0].name == "Mantid generated CanSAS1D XML") 
    92         self.assertTrue(data.meta_data["xmlpreprocess"]["xml-stylesheet"] != None) 
     92        self.assertTrue(data.meta_data["xmlpreprocess"] != None) 
    9393         
    9494     
     
    102102        xmlreader = XMLreader(self.isis_1_1, self.schema_1_1) 
    103103        valid = xmlreader.validateXML() 
     104        xmlreader.setProcessingInstructions() 
    104105        self.assertTrue(valid) 
     106        fo = open(self.isis_1_1) 
     107        str = fo.read() 
    105108        reader_generic = Loader() 
    106109        dataloader = reader_generic.load(self.isis_1_1) 
     
    113116            self._check_data_1_1(cansasreader[i]) 
    114117            reader_generic.save(filename, dataloader[i], None) 
    115             reader2 = Reader() 
    116             return_data = reader2.read(filename) 
    117             data_new = return_data 
     118            fo = open(filename) 
     119            str = fo.read() 
     120            reader2 = Loader() 
     121            return_data = reader2.load(filename) 
    118122            written_data = return_data[0] 
    119123            self._check_data(written_data) 
    120              
     124     
    121125     
    122126    def test_double_trans_spectra(self): 
     
    169173        self.assertTrue(reader4.validateXML()) 
    170174         
     175     
    171176    def test_save_cansas_v1_0(self): 
    172177        filename = "isis_1_0_write_test.xml" 
     
    184189            reader2 = Reader() 
    185190            return_data = reader2.read(filename) 
    186             data_new = return_data 
    187191            written_data = return_data[0] 
     192            xmlwrite = XMLreader(filename, self.schema_1_0) 
     193            valid = xmlreader.validateXML() 
     194            self.assertTrue(valid) 
    188195            self._check_data(written_data) 
    189196         
     
    230237        return dict 
    231238         
     239 
    232240if __name__ == '__main__': 
    233241    unittest.main()     
Note: See TracChangeset for help on using the changeset viewer.