- Timestamp:
- Apr 18, 2017 2:56:03 PM (8 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:
- 080d88e
- Parents:
- da8bb53
- git-author:
- Jeff Krzywon <krzywon@…> (04/18/17 14:56:03)
- git-committer:
- krzywon <krzywon@…> (04/18/17 14:56:03)
- Location:
- test/sasdataloader/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/utest_abs_reader.py
rdd11014 rad92c5a 4 4 5 5 import unittest 6 import math7 6 import numpy as np 8 7 from sas.sascalc.dataloader.loader import Loader 9 8 from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 10 from sas.sascalc.dataloader.data_info import Data1D 11 12 import os.path 13 14 class abs_reader(unittest.TestCase): 9 from sas.sascalc.dataloader.readers.abs_reader import Reader as ABSReader 10 11 12 class ABSReaderTests(unittest.TestCase): 15 13 16 14 def setUp(self): 17 from sas.sascalc.dataloader.readers.abs_reader import Reader18 self.data = Reader().read("jan08002.ABS")15 self.data_list = ABSReader().read("jan08002.ABS") 16 self.data = self.data_list[0] 19 17 20 18 def test_abs_checkdata(self): … … 38 36 39 37 self.assertEqual(self.data.detector[0].beam_center_unit, 'mm') 40 center_x = 114.58*5.0 41 center_y = 64.22*5.0 38 center_x = 114.58*5.08 39 center_y = 64.22*5.08 42 40 self.assertEqual(self.data.detector[0].beam_center.x, center_x) 43 41 self.assertEqual(self.data.detector[0].beam_center.y, center_y) … … 61 59 def test_checkdata2(self): 62 60 self.assertEqual(self.data.dy[126], 1) 63 64 class hfir_reader(unittest.TestCase): 65 61 62 63 class HFIRReaderTests(unittest.TestCase): 64 66 65 def setUp(self): 67 66 self.data = Loader().load("S2-30dq.d1d") 68 67 69 68 def test_hfir_checkdata(self): 70 69 """ … … 83 82 self.assertEqual(self.data.dy[1], 0.000315) 84 83 self.assertEqual(self.data.dx[1], 0.008249) 85 86 87 class igor_reader(unittest.TestCase):84 85 86 class IgorReaderTests(unittest.TestCase): 88 87 89 88 def setUp(self): … … 134 133 135 134 136 class danse_reader(unittest.TestCase):135 class DanseReaderTests(unittest.TestCase): 137 136 138 137 def setUp(self): … … 321 320 322 321 if _found_term1==False or _found_term2==False: 323 raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 324 325 326 327 322 raise RuntimeError, "Could not find all process terms %s %s" % (_found_term1, _found_term2) 323 328 324 def test_writer(self): 329 325 from sas.sascalc.dataloader.readers.cansas_reader import Reader … … 339 335 self.assertEqual(self.data.filename, filename) 340 336 self._checkdata() 341 337 342 338 def test_units(self): 343 339 """ … … 350 346 self.assertEqual(self.data.filename, filename) 351 347 self._checkdata() 352 348 353 349 def test_badunits(self): 354 350 """ … … 368 364 print self.data.errors 369 365 self.assertEqual(len(self.data.errors), 1) 370 371 366 372 367 def test_slits(self): 373 368 """ … … 397 392 self.assertEqual(self.data.run_name['1234'], 'run name') 398 393 self.assertEqual(self.data.title, "Test title") 399 400 394 401 395 402 396 if __name__ == '__main__': -
test/sasdataloader/test/utest_ascii.py
rb09095a rad92c5a 23 23 self.f5_list = self.loader.load("ascii_test_5.txt") 24 24 self.f5 = self.f5_list[0] 25 25 26 26 def test_checkdata(self): 27 27 """ … … 36 36 37 37 self.assertEqual(self.f1.meta_data['loader'],"ASCII") 38 38 39 39 def test_truncated_1(self): 40 40 """ … … 50 50 self.assertEqual(self.f2.x[0],0.002618) 51 51 self.assertEqual(self.f2.x[4],0.02356) 52 52 53 53 def test_truncated_2(self): 54 54 """ … … 62 62 self.assertEqual(self.f3.x[0],0.002618) 63 63 self.assertEqual(self.f3.x[4],0.02356) 64 64 65 65 def test_truncated_3(self): 66 66 """ … … 74 74 self.assertEqual(self.f4.x[0],0.012654) 75 75 self.assertEqual(self.f4.x[4],0.02654) 76 76 77 77 def test_truncated_4(self): 78 78 """ … … 84 84 self.assertEqual(self.f5.x[0],0.02879) 85 85 self.assertEqual(self.f5.x[4],0.0497) 86 86 87 87 def test_truncated_5(self): 88 88 """ … … 98 98 except: 99 99 self.assertEqual(f, None) 100 100 101 101 if __name__ == '__main__': 102 102 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.