Changeset 5f26aa4 in sasview for test/sasdataloader


Ignore:
Timestamp:
Aug 19, 2016 9:03:10 AM (8 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.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:
4abcc93a
Parents:
09afe90
git-author:
Jeff Krzywon <krzywon@…> (08/19/16 09:03:10)
git-committer:
Jeff KRzywon <krzywon@…> (08/19/16 09:03:10)
Message:

Fix cansas XML reader issues to resolve broken unit tests.

File:
1 edited

Legend:

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

    rb699768 r5f26aa4  
    176176         
    177177        self.assertEqual(self.data.run[0], "1234") 
    178         self.assertEqual(self.data.meta_data['loader'], "CanSAS 1D") 
    179         self.assertEqual(len(self.data.errors), 0) 
     178        self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 
    180179         
    181180        # Data 
     
    198197        self.assertEqual(self.data.sample.name, "my sample") 
    199198        self.assertEqual(self.data.sample.thickness_unit, 'mm') 
    200         self.assertEqual(self.data.sample.thickness, 1.03) 
    201          
    202         self.assertEqual(self.data.sample.transmission, 0.327) 
     199        self.assertAlmostEqual(self.data.sample.thickness, 1.03) 
     200         
     201        self.assertAlmostEqual(self.data.sample.transmission, 0.327) 
    203202         
    204203        self.assertEqual(self.data.sample.temperature_unit, 'C') 
     
    233232         
    234233        self.assertEqual(self.data.source.wavelength_max_unit, "nm") 
    235         self.assertEqual(self.data.source.wavelength_max, 1.0) 
     234        self.assertAlmostEqual(self.data.source.wavelength_max, 1.0) 
    236235        self.assertEqual(self.data.source.wavelength_min_unit, "nm") 
    237         self.assertEqual(self.data.source.wavelength_min, 0.22) 
     236        self.assertAlmostEqual(self.data.source.wavelength_min, 0.22) 
    238237        self.assertEqual(self.data.source.wavelength_spread_unit, "percent") 
    239238        self.assertEqual(self.data.source.wavelength_spread, 14.3) 
     
    248247            self.assertEqual(item.size_unit,'mm') 
    249248            self.assertEqual(item.distance_unit,'mm') 
    250              
     249 
    251250            if item.size.x==50 \ 
    252251                and item.distance==11000.0 \ 
     
    294293            self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 
    295294                                          '03-SEP-2006 11:42:47']) 
     295            print item.term 
    296296            for t in item.term: 
    297297                if t['name']=="ABS:DSTAND" \ 
     
    345345        self.assertEqual(self.data.filename, filename) 
    346346        # The followed should not have been loaded 
    347         self.assertEqual(self.data.sample.thickness, 0.00103) 
     347        self.assertAlmostEqual(self.data.sample.thickness, 0.00103) 
    348348        # This one should 
    349         self.assertEqual(self.data.sample.transmission, 0.327) 
    350          
    351         self.assertEqual(self.data.meta_data['loader'], "CanSAS 1D") 
     349        self.assertAlmostEqual(self.data.sample.transmission, 0.327) 
     350         
     351        self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 
    352352        print self.data.errors 
    353353        self.assertEqual(len(self.data.errors), 1) 
     
    385385 
    386386if __name__ == '__main__': 
    387     unittest.main(testRunner=unittest.TextTestRunner(verbosity=2)) 
     387    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.