- Timestamp:
- Aug 24, 2017 2:16:07 PM (7 years ago)
- 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d713729
- Parents:
- f001bc9
- Location:
- test/sasdataloader/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/utest_abs_reader.py
rce8c7bd r17e257b5 20 20 def setUp(self): 21 21 reader = AbsReader() 22 self.data = reader.read("jan08002.ABS") 22 data = reader.read("jan08002.ABS") 23 self.data= data[0] 23 24 24 25 def test_abs_checkdata(self): … … 69 70 # the generic loader should work as well 70 71 data = Loader().load("jan08002.ABS") 71 self.assertEqual(data .meta_data['loader'], "IGOR 1D")72 self.assertEqual(data[0].meta_data['loader'], "IGOR 1D") 72 73 73 74 class DanseReaderTests(unittest.TestCase): … … 75 76 def setUp(self): 76 77 reader = DANSEReader() 77 self.data = reader.read("MP_New.sans") 78 data = reader.read("MP_New.sans") 79 self.data = data[0] 78 80 79 81 def test_checkdata(self): … … 112 114 # the generic loader should work as well 113 115 data = Loader().load("MP_New.sans") 114 self.assertEqual(data .meta_data['loader'], "DANSE")116 self.assertEqual(data[0].meta_data['loader'], "DANSE") 115 117 116 118 … … 257 259 self.assertTrue(item.date in ['04-Sep-2007 18:35:02', 258 260 '03-SEP-2006 11:42:47']) 259 print(item.term)260 261 for t in item.term: 261 262 if (t['name'] == "ABS:DSTAND" … … 309 310 310 311 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") 311 print(self.data.errors) 312 self.assertEqual(len(self.data.errors), 1) 312 self.assertEqual(len(self.data.errors), 0) 313 313 314 314 def test_slits(self): … … 333 333 self.assertEqual(self.data.x[1], 0.03) 334 334 self.assertAlmostEquals(self.data.y[1], 1001.0) 335 self.assertEqual(self.data.dx , None)335 self.assertEqual(self.data.dx[0], 0.0) 336 336 self.assertEqual(self.data.dxl[1], 0.005) 337 337 self.assertEqual(self.data.dxw[1], 0.001) -
test/sasdataloader/test/utest_ascii.py
rad92c5a r17e257b5 32 32 self.assertEqual(self.f1.x[0],0.002618) 33 33 self.assertEqual(self.f1.x[9],0.0497) 34 self.assert Equal(self.f1.x_unit, '1/A')35 self.assert Equal(self.f1.y_unit, '1/cm')34 self.assertTrue(self.f1.x_unit == '1/A' or self.f1.x_unit == 'A^{-1}') 35 self.assertTrue(self.f1.y_unit == '1/cm' or self.f1.y_unit == 'cm^{-1}') 36 36 37 37 self.assertEqual(self.f1.meta_data['loader'],"ASCII") -
test/sasdataloader/test/utest_cansas.py
r1fc50fb2 r17e257b5 20 20 21 21 from lxml import etree 22 from lxml.etree import XMLSyntaxError 22 23 from xml.dom import minidom 23 24 … … 62 63 """ 63 64 invalid = StringIO.StringIO('<a><c></b></a>') 64 XMLreader(invalid)65 self.assertRaises(XMLSyntaxError, lambda: XMLreader(invalid)) 65 66 66 67 def test_xml_validate(self): … … 302 303 self.assertTrue(data._yunit == "cm^{-1}") 303 304 self.assertTrue(data.y.size == 100) 304 self.assertAlmostEqual(data.y[ 9], 0.952749011516985)305 self.assertAlmostEqual(data.x[ 9], 0.3834415188257777)305 self.assertAlmostEqual(data.y[40], 0.952749011516985) 306 self.assertAlmostEqual(data.x[40], 0.3834415188257777) 306 307 self.assertAlmostEqual(len(data.meta_data), 0) 307 308 -
test/sasdataloader/test/utest_sesans.py
ra67c494 r17e257b5 4 4 5 5 import unittest 6 from sas.sascalc.dataloader.loader_exceptions import FileContentsException,\ 7 DefaultReaderException 6 8 from sas.sascalc.dataloader.readers.sesans_reader import Reader 7 9 from sas.sascalc.dataloader.loader import Loader … … 17 19 Test .SES in the full loader to make sure that the file type is correctly accepted 18 20 """ 19 f = Loader().load("sesans_examples/sphere2micron.ses") 21 file = Loader().load("sesans_examples/sphere2micron.ses") 22 f = file[0] 20 23 # self.assertEqual(f, 5) 21 24 self.assertEqual(len(f.x), 40) … … 34 37 Test .SES loading on a TOF dataset 35 38 """ 36 f = self.loader("sesans_examples/sphere_isis.ses") 39 file = self.loader("sesans_examples/sphere_isis.ses") 40 f = file[0] 37 41 self.assertEqual(len(f.x), 57) 38 42 self.assertEqual(f.x[-1], 19303.4) … … 48 52 """ 49 53 self.assertRaises( 50 RuntimeError,54 FileContentsException, 51 55 self.loader, 52 56 "sesans_examples/sesans_no_data.ses") … … 57 61 """ 58 62 self.assertRaises( 59 RuntimeError,63 FileContentsException, 60 64 self.loader, 61 65 "sesans_examples/no_spin_echo_unit.ses") … … 65 69 Confirm that sesans files with no file format version raise an appropriate error 66 70 """ 67 self.assertRaises( 68 RuntimeError, 69 self.loader, 70 "sesans_examples/no_version.ses") 71 # Warning message sent to logger for files not found. 72 pass 71 73 72 74 def test_sesans_future_version(self): … … 75 77 """ 76 78 self.assertRaises( 77 RuntimeError,79 FileContentsException, 78 80 self.loader, 79 81 "sesans_examples/next_gen.ses") … … 84 86 """ 85 87 self.assertRaises( 86 RuntimeError,88 FileContentsException, 87 89 self.loader, 88 90 "sesans_examples/no_wavelength.ses") … … 93 95 """ 94 96 self.assertRaises( 95 RuntimeError,97 FileContentsException, 96 98 self.loader, 97 99 "sesans_examples/too_many_headers.ses")
Note: See TracChangeset
for help on using the changeset viewer.