- Timestamp:
- Dec 6, 2017 11:04:17 AM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- a64f8f4, b6b81a3, 0a88623, 66285f5
- Parents:
- f53d684 (diff), bc4f5bb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Paul Kienzle <pkienzle@…> (12/06/17 11:04:17)
- git-committer:
- GitHub <noreply@…> (12/06/17 11:04:17)
- Location:
- test
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sascalculator/test/utest_sas_gen.py
rf53d684 r5bb05a4 8 8 9 9 import unittest 10 import numpy as np 11 10 12 from sas.sascalc.calculator import sas_gen 11 13 … … 54 56 self.assertEqual(output.pos_z[0], 0.0) 55 57 58 def test_calculator(self): 59 """ 60 Test that the calculator calculates. 61 """ 62 f = self.omfloader.read("A_Raw_Example-1.omf") 63 omf2sld = sas_gen.OMF2SLD() 64 omf2sld.set_data(f) 65 model = sas_gen.GenSAS() 66 model.set_sld_data(omf2sld.output) 67 x = np.linspace(0, 0.1, 11)[1:] 68 model.runXY([x, x]) 69 56 70 57 71 if __name__ == '__main__': -
test/corfunc/test/utest_corfunc.py
r86ba9d6 rf53d684 4 4 from __future__ import division, print_function 5 5 6 import os.path 6 7 import unittest 7 8 import time … … 11 12 from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 12 13 from sas.sascalc.dataloader.data_info import Data1D 14 15 16 def find(filename): 17 return os.path.join(os.path.dirname(__file__), filename) 13 18 14 19 … … 31 36 self.extrapolation = None 32 37 self.transformation = None 33 self.results = [np.loadtxt(fi lename+"_out.txt").T[2]38 self.results = [np.loadtxt(find(filename+"_out.txt")).T[2] 34 39 for filename in ("gamma1", "gamma3", "idf")] 35 40 … … 110 115 111 116 def load_data(filename="98929.txt"): 112 data = np.loadtxt(fi lename, dtype=np.float64)117 data = np.loadtxt(find(filename), dtype=np.float64) 113 118 q = data[:,0] 114 119 iq = data[:,1] -
test/fileconverter/test/utest_nxcansas_writer.py
rc16ffe7 rf53d684 3 3 4 4 import os 5 import os.path 5 6 import unittest 6 7 import warnings 7 8 8 9 warnings.simplefilter("ignore") 10 11 12 def find(filename): 13 return os.path.join(os.path.dirname(__file__), filename) 14 9 15 10 16 class nxcansas_writer(unittest.TestCase): … … 13 19 self.loader = Loader() 14 20 self.writer = NXcanSASWriter() 15 self.read_file_1d = "cansas1d.xml"16 self.write_file_1d = "export1d.h5"17 self.read_file_2d = "exp18_14_igor_2dqxqy.dat"18 self.write_file_2d = "export2d.h5"21 self.read_file_1d = find("cansas1d.xml") 22 self.write_file_1d = find("export1d.h5") 23 self.read_file_2d = find("exp18_14_igor_2dqxqy.dat") 24 self.write_file_2d = find("export2d.h5") 19 25 20 26 self.data_1d = self.loader.load(self.read_file_1d)[0] -
test/pr_inversion/test/utest_explorer.py
r959eb01 rf53d684 3 3 """ 4 4 5 import os.path 5 6 import unittest, math, numpy 6 7 from utest_invertor import load 7 8 from sas.sascalc.pr.invertor import Invertor 8 9 from sas.sascalc.pr.distance_explorer import DistExplorer 9 10 11 12 def find(filename): 13 return os.path.join(os.path.dirname(__file__), filename) 14 15 10 16 class TestExplorer(unittest.TestCase): 11 17 12 18 def setUp(self): 13 19 self.invertor = Invertor() 14 x, y, err = load( 'sphere_80.txt')20 x, y, err = load(find('sphere_80.txt')) 15 21 16 22 # Choose the right d_max... -
test/pr_inversion/test/utest_invertor.py
rcb62bd5 rf53d684 10 10 11 11 import os 12 import os.path 12 13 import unittest 13 14 import math 14 15 import numpy 15 16 from sas.sascalc.pr.invertor import Invertor 17 18 19 def find(filename): 20 return os.path.join(os.path.dirname(__file__), filename) 16 21 17 22 … … 28 33 self.x_in[i] = 1.0*(i+1) 29 34 30 x, y, err = load( "sphere_80.txt")35 x, y, err = load(find("sphere_80.txt")) 31 36 32 37 # Choose the right d_max... … … 192 197 Test an inversion for which we know the answer 193 198 """ 194 x, y, err = load( "sphere_80.txt")199 x, y, err = load(find("sphere_80.txt")) 195 200 196 201 # Choose the right d_max... … … 247 252 Test an inversion for which we know the answer 248 253 """ 249 x, y, err = load( "sphere_80.txt")254 x, y, err = load(find("sphere_80.txt")) 250 255 251 256 # Choose the right d_max... … … 312 317 Test error condition where a point has q=0 313 318 """ 314 x, y, err = load( "sphere_80.txt")319 x, y, err = load(find("sphere_80.txt")) 315 320 x[0] = 0.0 316 321 … … 329 334 Test error condition where a point has q<0 330 335 """ 331 x, y, err = load( "sphere_80.txt")336 x, y, err = load(find("sphere_80.txt")) 332 337 x[0] = -0.2 333 338 … … 353 358 Test error condition where a point has q<0 354 359 """ 355 x, y, err = load( "sphere_80.txt")360 x, y, err = load(find("sphere_80.txt")) 356 361 y[0] = 0.0 357 362 … … 374 379 375 380 def no_test_time(self): 376 x, y, err = load( "sphere_80.txt")381 x, y, err = load(find("sphere_80.txt")) 377 382 378 383 # Choose the right d_max... … … 406 411 407 412 def test_save(self): 408 x, y, err = load( "sphere_80.txt")413 x, y, err = load(find("sphere_80.txt")) 409 414 410 415 # Choose the right d_max... … … 464 469 Test an inversion for which we know the answer 465 470 """ 466 x, y, err = load( "data_error_1.txt")471 x, y, err = load(find("data_error_1.txt")) 467 472 468 473 # Choose the right d_max... … … 482 487 Have zero as an error should raise an exception 483 488 """ 484 x, y, err = load( "data_error_2.txt")489 x, y, err = load(find("data_error_2.txt")) 485 490 486 491 # Set data … … 495 500 Test an inversion for which we know the answer 496 501 """ 497 x, y, err = load( "data_error_1.txt")502 x, y, err = load(find("data_error_1.txt")) 498 503 499 504 # Set data … … 511 516 An exception should be raised. 512 517 """ 513 x, y, err = load( "data_error_3.txt")518 x, y, err = load(find("data_error_3.txt")) 514 519 515 520 # Set data … … 521 526 Should not complain or crash. 522 527 """ 523 x, y, err = load( "data_error_4.txt")528 x, y, err = load(find("data_error_4.txt")) 524 529 525 530 # Set data … … 535 540 Makes not sense, but should not complain or crash. 536 541 """ 537 x, y, err = load( "data_error_5.txt")542 x, y, err = load(find("data_error_5.txt")) 538 543 539 544 # Set data … … 549 554 Makes not sense, but should not complain or crash. 550 555 """ 551 x, y, err = load( "data_error_6.txt")556 x, y, err = load(find("data_error_6.txt")) 552 557 553 558 # Set data -
test/sascalculator/test/utest_slit_length_calculator.py
rb09095a rf53d684 3 3 """ 4 4 5 import os.path 5 6 import unittest 6 7 from sas.sascalc.dataloader.readers.ascii_reader import Reader 7 8 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator \ 8 9 as calculator 10 11 12 def find(filename): 13 return os.path.join(os.path.dirname(__file__), filename) 9 14 10 15 … … 19 24 Test slit_length_calculator" 20 25 """ 21 list = self.reader.read( "beam profile.DAT")26 list = self.reader.read(find("beam profile.DAT")) 22 27 self.assertTrue(len(list) == 1) 23 28 f = list[0] -
test/sasdataloader/test/utest_abs_reader.py
rfe15198 rf53d684 16 16 17 17 18 def find(filename): 19 return os.path.join(os.path.dirname(__file__), filename) 20 21 18 22 class abs_reader(unittest.TestCase): 19 23 20 24 def setUp(self): 21 25 reader = AbsReader() 22 self.data_list = reader.read( "jan08002.ABS")26 self.data_list = reader.read(find("jan08002.ABS")) 23 27 self.data = self.data_list[0] 24 28 … … 31 35 tests won't pass 32 36 """ 33 self.assertEqual( self.data.filename, "jan08002.ABS")37 self.assertEqual(os.path.basename(self.data.filename), "jan08002.ABS") 34 38 self.assertEqual(self.data.meta_data['loader'], "IGOR 1D") 35 39 … … 69 73 def test_generic_loader(self): 70 74 # the generic loader should work as well 71 data = Loader().load( "jan08002.ABS")75 data = Loader().load(find("jan08002.ABS")) 72 76 self.assertEqual(data[0].meta_data['loader'], "IGOR 1D") 73 77 … … 76 80 def setUp(self): 77 81 reader = DANSEReader() 78 self.data_list = reader.read( "MP_New.sans")82 self.data_list = reader.read(find("MP_New.sans")) 79 83 self.data = self.data_list[0] 80 84 … … 88 92 """ 89 93 self.assertEqual(len(self.data_list), 1) 90 self.assertEqual( self.data.filename, "MP_New.sans")94 self.assertEqual(os.path.basename(self.data.filename), "MP_New.sans") 91 95 self.assertEqual(self.data.meta_data['loader'], "DANSE") 92 96 … … 114 118 def test_generic_loader(self): 115 119 # the generic loader should work as well 116 data = Loader().load( "MP_New.sans")120 data = Loader().load(find("MP_New.sans")) 117 121 self.assertEqual(len(data), 1) 118 122 self.assertEqual(data[0].meta_data['loader'], "DANSE") … … 123 127 def setUp(self): 124 128 reader = CANSASReader() 125 self.data_list = reader.read( "cansas1d.xml")129 self.data_list = reader.read(find("cansas1d.xml")) 126 130 self.data = self.data_list[0] 127 131 128 132 def test_generic_loader(self): 129 133 # the generic loader should work as well 130 data = Loader().load( "cansas1d.xml")134 data = Loader().load(find("cansas1d.xml")) 131 135 self.assertEqual(len(data), 1) 132 136 self.assertEqual(data[0].meta_data['loader'], "CanSAS XML 1D") 133 137 134 138 def test_cansas_checkdata(self): 135 self.assertEqual( self.data.filename, "cansas1d.xml")139 self.assertEqual(os.path.basename(self.data.filename), "cansas1d.xml") 136 140 self._checkdata() 137 141 … … 282 286 283 287 filename = "write_test.xml" 284 r.write(fi lename, self.data)285 data = Loader().load(fi lename)288 r.write(find(filename), self.data) 289 data = Loader().load(find(filename)) 286 290 self.data = data[0] 287 291 self.assertEqual(len(data), 1) … … 297 301 """ 298 302 filename = "cansas1d_units.xml" 299 data = CANSASReader().read(fi lename)303 data = CANSASReader().read(find(filename)) 300 304 self.data = data[0] 301 305 self.assertEqual(len(data), 1) … … 309 313 """ 310 314 filename = "cansas1d_badunits.xml" 311 data = CANSASReader().read(fi lename)315 data = CANSASReader().read(find(filename)) 312 316 self.data = data[0] 313 317 self.assertEqual(len(data), 1) … … 326 330 """ 327 331 filename = "cansas1d_slit.xml" 328 data = CANSASReader().read(fi lename)332 data = CANSASReader().read(find(filename)) 329 333 self.data = data[0] 330 334 self.assertEqual(len(data), 1) -
test/sasdataloader/test/utest_ascii.py
rfe15198 rf53d684 2 2 Unit tests for the ascii (n-column) reader 3 3 """ 4 5 import os.path 4 6 import warnings 5 7 warnings.simplefilter("ignore") … … 9 11 10 12 13 def find(filename): 14 return os.path.join(os.path.dirname(__file__), filename) 15 16 11 17 class ABSReaderTests(unittest.TestCase): 12 18 13 19 def setUp(self): 14 20 self.loader = Loader() 15 self.f1_list = self.loader.load( "ascii_test_1.txt")21 self.f1_list = self.loader.load(find("ascii_test_1.txt")) 16 22 self.f1 = self.f1_list[0] 17 self.f2_list = self.loader.load( "ascii_test_2.txt")23 self.f2_list = self.loader.load(find("ascii_test_2.txt")) 18 24 self.f2 = self.f2_list[0] 19 self.f3_list = self.loader.load( "ascii_test_3.txt")25 self.f3_list = self.loader.load(find("ascii_test_3.txt")) 20 26 self.f3 = self.f3_list[0] 21 self.f4_list = self.loader.load( "ascii_test_4.abs")27 self.f4_list = self.loader.load(find("ascii_test_4.abs")) 22 28 self.f4 = self.f4_list[0] 23 self.f5_list = self.loader.load( "ascii_test_5.txt")29 self.f5_list = self.loader.load(find("ascii_test_5.txt")) 24 30 self.f5 = self.f5_list[0] 25 31 … … 99 105 f = None 100 106 try: 101 f = self.loader.load( "ascii_test_6.txt")107 f = self.loader.load(find("ascii_test_6.txt")) 102 108 # The length of the data is 5 103 109 except: -
test/sasdataloader/test/utest_averaging.py
rfe15198 rf53d684 13 13 SlabY, get_q, 14 14 reader2D_converter) 15 16 17 def find(filename): 18 return os.path.join(os.path.dirname(__file__), filename) 15 19 16 20 … … 102 106 103 107 def setUp(self): 104 filepath = os.path.join(os.path.dirname( 105 os.path.realpath(__file__)), 'MAR07232_rest.h5') 108 filepath = find('MAR07232_rest.h5') 106 109 self.data_list = Loader().load(filepath) 107 110 self.data = self.data_list[0] … … 118 121 119 122 o = r(self.data) 120 filepath = os.path.join(os.path.dirname( 121 os.path.realpath(__file__)), 'ring_testdata.txt') 123 filepath = find('ring_testdata.txt') 122 124 answer_list = Loader().load(filepath) 123 125 answer = answer_list[0] … … 140 142 o = r(self.data) 141 143 142 filepath = os.path.join(os.path.dirname( 143 os.path.realpath(__file__)), 'avg_testdata.txt') 144 filepath = find('avg_testdata.txt') 144 145 answer = Loader().load(filepath)[0] 145 146 for i in range(r.nbins_phi): … … 176 177 o = r(self.data) 177 178 178 filepath = os.path.join(os.path.dirname( 179 os.path.realpath(__file__)), 'slabx_testdata.txt') 179 filepath = find('slabx_testdata.txt') 180 180 answer = Loader().load(filepath)[0] 181 181 for i in range(len(o.x)): … … 195 195 o = r(self.data) 196 196 197 filepath = os.path.join(os.path.dirname( 198 os.path.realpath(__file__)), 'slaby_testdata.txt') 197 filepath = find('slaby_testdata.txt') 199 198 answer = Loader().load(filepath)[0] 200 199 for i in range(len(o.x)): … … 222 221 o = r(self.data) 223 222 224 filepath = os.path.join(os.path.dirname( 225 os.path.realpath(__file__)), 'ring_testdata.txt') 223 filepath = find('ring_testdata.txt') 226 224 answer = Loader().load(filepath)[0] 227 225 for i in range(len(o.x)): … … 240 238 o = r(self.data) 241 239 242 filepath = os.path.join(os.path.dirname( 243 os.path.realpath(__file__)), 'sectorphi_testdata.txt') 240 filepath = find('sectorphi_testdata.txt') 244 241 answer = Loader().load(filepath)[0] 245 242 for i in range(len(o.x)): … … 258 255 o = r(self.data) 259 256 260 filepath = os.path.join(os.path.dirname( 261 os.path.realpath(__file__)), 'sectorq_testdata.txt') 257 filepath = find('sectorq_testdata.txt') 262 258 answer = Loader().load(filepath)[0] 263 259 for i in range(len(o.x)): -
test/sasdataloader/test/utest_cansas.py
rf00072f rf53d684 31 31 CANSAS_NS = CansasConstants.CANSAS_NS 32 32 33 34 def find(filename): 35 return os.path.join(os.path.dirname(__file__), filename) 36 37 33 38 class cansas_reader_xml(unittest.TestCase): 34 39 35 40 def setUp(self): 36 41 self.loader = Loader() 37 self.xml_valid = "cansas_test_modified.xml"38 self.xml_invalid = "cansas_test.xml"39 self.cansas1d_badunits = "cansas1d_badunits.xml"40 self.cansas1d = "cansas1d.xml"41 self.cansas1d_slit = "cansas1d_slit.xml"42 self.cansas1d_units = "cansas1d_units.xml"43 self.cansas1d_notitle = "cansas1d_notitle.xml"44 self.isis_1_0 = "ISIS_1_0.xml"45 self.isis_1_1 = "ISIS_1_1.xml"46 self.isis_1_1_notrans = "ISIS_1_1_notrans.xml"47 self.isis_1_1_doubletrans = "ISIS_1_1_doubletrans.xml"48 self.schema_1_0 = "cansas1d_v1_0.xsd"49 self.schema_1_1 = "cansas1d_v1_1.xsd"50 self.write_1_0_filename = "isis_1_0_write_test.xml"51 self.write_1_1_filename = "isis_1_1_write_test.xml"42 self.xml_valid = find("cansas_test_modified.xml") 43 self.xml_invalid = find("cansas_test.xml") 44 self.cansas1d_badunits = find("cansas1d_badunits.xml") 45 self.cansas1d = find("cansas1d.xml") 46 self.cansas1d_slit = find("cansas1d_slit.xml") 47 self.cansas1d_units = find("cansas1d_units.xml") 48 self.cansas1d_notitle = find("cansas1d_notitle.xml") 49 self.isis_1_0 = find("ISIS_1_0.xml") 50 self.isis_1_1 = find("ISIS_1_1.xml") 51 self.isis_1_1_notrans = find("ISIS_1_1_notrans.xml") 52 self.isis_1_1_doubletrans = find("ISIS_1_1_doubletrans.xml") 53 self.schema_1_0 = find("cansas1d_v1_0.xsd") 54 self.schema_1_1 = find("cansas1d_v1_1.xsd") 55 self.write_1_0_filename = find("isis_1_0_write_test.xml") 56 self.write_1_1_filename = find("isis_1_1_write_test.xml") 52 57 53 58 def get_number_of_entries(self, dictionary, name, i): … … 254 259 def setUp(self): 255 260 self.loader = Loader() 256 self.datafile_basic = "simpleexamplefile.h5"257 self.datafile_multiplesasentry = "cansas_1Dand2D_samedatafile.h5"258 self.datafile_multiplesasdata = "cansas_1Dand2D_samesasentry.h5"259 self.datafile_multiplesasdata_multiplesasentry = "cansas_1Dand2D_multiplesasentry_multiplesasdata.h5"261 self.datafile_basic = find("simpleexamplefile.h5") 262 self.datafile_multiplesasentry = find("cansas_1Dand2D_samedatafile.h5") 263 self.datafile_multiplesasdata = find("cansas_1Dand2D_samesasentry.h5") 264 self.datafile_multiplesasdata_multiplesasentry = find("cansas_1Dand2D_multiplesasentry_multiplesasdata.h5") 260 265 261 266 def test_real_data(self): -
test/sasdataloader/test/utest_extension_registry.py
rdcb91cf rf53d684 13 13 logger = logging.getLogger(__name__) 14 14 15 16 def find(filename): 17 return os.path.join(os.path.dirname(__file__), filename) 18 19 15 20 class ExtensionRegistryTests(unittest.TestCase): 16 21 17 22 def setUp(self): 18 self.valid_file = "valid_cansas_xml.xml"19 self.valid_file_wrong_known_ext = "valid_cansas_xml.txt"20 self.valid_file_wrong_unknown_ext = "valid_cansas_xml.xyz"23 self.valid_file = find("valid_cansas_xml.xml") 24 self.valid_file_wrong_known_ext = find("valid_cansas_xml.txt") 25 self.valid_file_wrong_unknown_ext = find("valid_cansas_xml.xyz") 21 26 shutil.copyfile(self.valid_file, self.valid_file_wrong_known_ext) 22 27 shutil.copyfile(self.valid_file, self.valid_file_wrong_unknown_ext) 23 self.invalid_file = "cansas1d_notitle.xml"28 self.invalid_file = find("cansas1d_notitle.xml") 24 29 25 30 self.loader = Loader() -
test/sasdataloader/test/utest_generic_file_reader_class.py
r3648cbf rf53d684 14 14 15 15 16 def find(filename): 17 return os.path.join(os.path.dirname(__file__), filename) 18 19 16 20 class GenericFileReaderTests(unittest.TestCase): 17 21 18 22 def setUp(self): 19 23 self.reader = TestFileReader() 20 self.bad_file = "ACB123.txt"21 self.good_file = "123ABC.txt"24 self.bad_file = find("ACB123.txt") 25 self.good_file = find("123ABC.txt") 22 26 23 27 def test_bad_file_path(self): -
test/sasdataloader/test/utest_red2d_reader.py
rfe15198 rf53d684 10 10 import os.path 11 11 12 13 def find(filename): 14 return os.path.join(os.path.dirname(__file__), filename) 15 16 12 17 class abs_reader(unittest.TestCase): 13 18 14 19 def setUp(self): 15 20 self.loader = Loader() 16 self.data_list = self.loader.load( "exp18_14_igor_2dqxqy.dat")21 self.data_list = self.loader.load(find("exp18_14_igor_2dqxqy.dat")) 17 22 18 23 def test_checkdata(self): -
test/sasdataloader/test/utest_sesans.py
rfe15198 rf53d684 3 3 """ 4 4 5 import os.path 5 6 import unittest 6 7 from sas.sascalc.dataloader.loader_exceptions import FileContentsException,\ … … 8 9 from sas.sascalc.dataloader.readers.sesans_reader import Reader 9 10 from sas.sascalc.dataloader.loader import Loader 11 12 13 def find(filename): 14 return os.path.join(os.path.dirname(__file__), filename) 15 10 16 11 17 class sesans_reader(unittest.TestCase): … … 19 25 Test .SES in the full loader to make sure that the file type is correctly accepted 20 26 """ 21 file = Loader().load( "sesans_examples/sphere2micron.ses")27 file = Loader().load(find("sesans_examples/sphere2micron.ses")) 22 28 f = file[0] 23 29 # self.assertEqual(f, 5) … … 38 44 Test .SES loading on a TOF dataset 39 45 """ 40 file = self.loader( "sesans_examples/sphere_isis.ses")46 file = self.loader(find("sesans_examples/sphere_isis.ses")) 41 47 f = file[0] 42 48 self.assertEqual(len(file), 1) … … 56 62 FileContentsException, 57 63 self.loader, 58 "sesans_examples/sesans_no_data.ses")64 find("sesans_examples/sesans_no_data.ses")) 59 65 60 66 def test_sesans_no_spin_echo_unit(self): … … 65 71 FileContentsException, 66 72 self.loader, 67 "sesans_examples/no_spin_echo_unit.ses")73 find("sesans_examples/no_spin_echo_unit.ses")) 68 74 69 75 def test_sesans_future_version(self): … … 74 80 FileContentsException, 75 81 self.loader, 76 "sesans_examples/next_gen.ses")82 find("sesans_examples/next_gen.ses")) 77 83 78 84 def test_sesans_mandatory_headers(self): … … 83 89 FileContentsException, 84 90 self.loader, 85 "sesans_examples/no_wavelength.ses")91 find("sesans_examples/no_wavelength.ses")) 86 92 87 93 def test_sesans_columns_match_headers(self): … … 92 98 FileContentsException, 93 99 self.loader, 94 "sesans_examples/too_many_headers.ses")100 find("sesans_examples/too_many_headers.ses")) 95 101 96 102 if __name__ == "__main__": -
test/sasguiframe/test/utest_manipulations.py
rc0ca2e3d rf53d684 15 15 16 16 17 def find(filename): 18 return os.path.join(os.path.dirname(__file__), filename) 19 20 17 21 class DataInfoTests(unittest.TestCase): 18 22 19 23 def setUp(self): 20 data = Loader().load( "cansas1d.xml")24 data = Loader().load(find("cansas1d.xml")) 21 25 self.data = data[0] 22 26 … … 35 39 36 40 def setUp(self): 37 data = Loader().load( "cansas1d.xml")41 data = Loader().load(find("cansas1d.xml")) 38 42 self.data = data[0] 39 43 -
test/sasinvariant/test/utest_data_handling.py
r9a5097c rf53d684 8 8 copyright 2010, University of Tennessee 9 9 """ 10 11 import os.path 10 12 import unittest 11 13 import math … … 15 17 16 18 from sas.sascalc.invariant import invariant 17 19 20 21 def find(filename): 22 return os.path.join(os.path.dirname(__file__), filename) 23 24 18 25 class TestLinearFit(unittest.TestCase): 19 26 """ … … 94 101 """ 95 102 def setUp(self): 96 data = Loader().load( "latex_smeared_slit.xml")103 data = Loader().load(find("latex_smeared_slit.xml")) 97 104 self.data = data[0] 98 105 self.data.dxl = None … … 676 683 value = math.fabs(test_y[i]- temp[i])/temp[i] 677 684 self.assert_(value < 0.001) 678 -
test/sasinvariant/test/utest_use_cases.py
rb09095a rf53d684 4 4 """ 5 5 #TODO: there's no test for smeared extrapolation 6 7 import os.path 6 8 import unittest 7 9 from sas.sascalc.dataloader.loader import Loader … … 9 11 10 12 13 def find(filename): 14 return os.path.join(os.path.dirname(__file__), filename) 15 16 11 17 class Data1D: 12 18 pass … … 18 24 """ 19 25 def setUp(self): 20 self.data_list = Loader().load( "linefittest.txt")26 self.data_list = Loader().load(find("linefittest.txt")) 21 27 self.data = self.data_list[0] 22 28 … … 57 63 """ 58 64 def setUp(self): 59 self.data_list = Loader().load( "linefittest_no_weight.txt")65 self.data_list = Loader().load(find("linefittest_no_weight.txt")) 60 66 self.data = self.data_list[0] 61 67 … … 96 102 """ 97 103 def setUp(self): 98 self.data_list = Loader().load( "PolySpheres.txt")104 self.data_list = Loader().load(find("PolySpheres.txt")) 99 105 self.data = self.data_list[0] 100 106 … … 278 284 def setUp(self): 279 285 # data with smear info 280 list = Loader().load( "latex_smeared.xml")286 list = Loader().load(find("latex_smeared.xml")) 281 287 self.data_q_smear = list[0] 282 288
Note: See TracChangeset
for help on using the changeset viewer.