Commit 517bf1a3 authored by David Fairbrother's avatar David Fairbrother
Browse files

Manually remove/fix any unused or duplicate vars

Manually removes or fixes any unused or duplicate variables, test names
or workspace names in the remaining tests
parent 9ea016a8
......@@ -25,9 +25,9 @@ class SingleDomainDoublePulseFitTest(unittest.TestCase):
N0 = 6.38
y = N0 * (1 + y1 / 2 + y2 / 2)
y_norm = y1 / 2 + y2 / 2
unnormalised_workspace = CreateWorkspace(x, y)
ws_to_normalise = CreateWorkspace(x, y)
ws_correctly_normalised = CreateWorkspace(x, y_norm)
CreateWorkspace(x, y, OutputWorkspace="unnormalised_workspace")
CreateWorkspace(x, y, OutputWorkspace="ws_to_normalise")
CreateWorkspace(x, y_norm, OutputWorkspace="ws_correctly_normalised")
AddSampleLog(Workspace='ws_to_normalise', LogName="analysis_asymmetry_norm", LogText="1")
innerFunction = FunctionFactory.createInitialized('name=GausOsc,A=0.20,Sigma=0.2,Frequency=1.0,Phi=0')
......
......@@ -67,7 +67,6 @@ class CrystalFieldTests(unittest.TestCase):
en, wf, ham = energies(2, B20=0.035, B40=-0.012, B43=-0.027, B60=-0.00012, B63=0.0025, B66=0.0068)
self._do_test_eigensystem(en, wf, ham)
expectedEigenvalues = [0, 0, 4.36, 9.64, 9.64, 20.65, 30.03, 30.03, 52.50]
emin = np.amin(en)
for i in range(9):
self.assertAlmostEqual(expectedEigenvalues[i], en[i], 1)
# Now test the eigenvectors by computing the dipole transition matrix elements. Use the magnetic field
......@@ -1150,6 +1149,7 @@ class CrystalFieldFitTest(unittest.TestCase):
def test_ResolutionModel_func_multi(self):
from CrystalField import ResolutionModel
def func0(x):
return np.sin(np.array(x))
......@@ -1208,7 +1208,7 @@ class CrystalFieldFitTest(unittest.TestCase):
cf = CrystalField('Ce', 'C2v', B20=0.37, B22=3.97, B40=-0.0317, B42=-0.116, B44=-0.12,
Temperature=44.0, FWHM=1.0, ResolutionModel=rm)
sp = cf.getSpectrum()
self.assertAlmostEqual(cf.peaks.param[1]['PeakCentre'], 29.0507341109, 8)
self.assertAlmostEqual(cf.peaks.param[0]['FWHM'], 1.0, 8)
self.assertAlmostEqual(cf.peaks.param[1]['FWHM'], 1.581014682, 8)
......@@ -1223,7 +1223,7 @@ class CrystalFieldFitTest(unittest.TestCase):
cf = CrystalField('Ce', 'C2v', B20=0.37, B22=3.97, B40=-0.0317, B42=-0.116, B44=-0.12,
Temperature=44.0, FWHM=1.0, ResolutionModel=rm, FWHMVariation=0.3)
sp = cf.getSpectrum()
self.assertAlmostEqual(cf.peaks.param[0]['FWHM'], 1.0, 8)
self.assertAlmostEqual(cf.peaks.param[1]['FWHM'], 1.58101, 1)
self.assertAlmostEqual(cf.peaks.param[2]['FWHM'], 1.85644, 1)
......@@ -1527,10 +1527,10 @@ class CrystalFieldFitTest(unittest.TestCase):
Temperature=[10, 100], FWHM=[1.1, 1.2])
ws0 = makeWorkspace(*origin.getSpectrum(0))
ws1 = makeWorkspace(*origin.getSpectrum(1))
wscv = makeWorkspace(*origin.getHeatCapacity())
makeWorkspace(*origin.getHeatCapacity())
wschi = makeWorkspace(*origin.getSusceptibility(Hdir='powder'))
wsmag = makeWorkspace(*origin.getMagneticMoment(Hdir=[0, 1, 0], Hmag=np.linspace(0, 30, 3)))
wsmom = makeWorkspace(*origin.getMagneticMoment(H=100, T=np.linspace(1, 300, 300), Unit='cgs'))
makeWorkspace(*origin.getMagneticMoment(H=100, T=np.linspace(1, 300, 300), Unit='cgs'))
# Fits single physical properties dataset
cf = CrystalField('Ce', 'C2v', B20=0.37, B22=3.97, B40=-0.0317, B42=-0.116, B44=-0.12)
......
......@@ -66,7 +66,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
clean_up(files)
tReducer.prop_man.save_format = ''
tws = CreateSampleWorkspace(Function='Flat background', NumBanks=1, BankPixelWidth=1, \
tws = CreateSampleWorkspace(Function='Flat background', NumBanks=1, BankPixelWidth=1,
NumEvents=10, XUnit='DeltaE', XMin=-10, XMax=10, BinWidth=0.1)
self.assertEqual(len(tReducer.prop_man.save_format), 0)
......@@ -245,7 +245,8 @@ class DirectEnergyConversionTest(unittest.TestCase):
EnWs = ConvertUnits(InputWorkspace='TOF_WS', Target='Energy', EMode='Elastic')
eni = EnWs.dataX(0)
for samp, rez in zip(eni, en_range): self.assertAlmostEqual(samp, rez)
for samp, rez in zip(eni, en_range):
self.assertAlmostEqual(samp, rez)
# Now Test shifted:
ei, mon1_peak, mon1_index, tzero = GetEi(InputWorkspace=ws, Monitor1Spec=int(2), Monitor2Spec=int(3),
......@@ -274,7 +275,8 @@ class DirectEnergyConversionTest(unittest.TestCase):
EnWs = ConvertUnits(InputWorkspace='TOF_WS', Target='Energy', EMode='Elastic')
eni = EnWs.dataX(0)
for samp, rez in zip(eni, en_range): self.assertAlmostEqual(samp, rez)
for samp, rez in zip(eni, en_range):
self.assertAlmostEqual(samp, rez)
def test_late_rebinning(self):
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, NumEvents=100000,
......@@ -316,7 +318,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
def test_tof_range(self):
run = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=6, BankPixelWidth=1, NumEvents=10, \
run = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=6, BankPixelWidth=1, NumEvents=10,
XUnit='Energy', XMin=5, XMax=75, BinWidth=0.2)
LoadInstrument(run, InstrumentName='MARI', RewriteSpectraMap=True)
......@@ -337,7 +339,6 @@ class DirectEnergyConversionTest(unittest.TestCase):
x = run_tof.readX(3)
dx = abs(x[1:] - x[:-1])
xMin = min(x)
dt = min(dx)
x = run_tof.readX(5)
xMax = max(x)
......@@ -361,7 +362,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
def test_multirep_mode(self):
# create test workspace
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, \
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1,
NumEvents=100000, XUnit='Energy', XMin=3, XMax=200, BinWidth=0.1)
LoadInstrument(run_monitors, InstrumentName='MARI', RewriteSpectraMap=True)
ConvertUnits(InputWorkspace='run_monitors', OutputWorkspace='run_monitors', Target='TOF')
......@@ -369,7 +370,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
tof = run_monitors.dataX(3)
tMin = tof[0]
tMax = tof[-1]
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1, \
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1,
NumEvents=100000, XUnit='TOF', xMin=tMin, xMax=tMax)
LoadInstrument(run, InstrumentName='MARI', RewriteSpectraMap=True)
MoveInstrumentComponent(Workspace='run', ComponentName='Detector', DetectorID=1102, Z=1)
......@@ -378,7 +379,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
# do second
run2 = CloneWorkspace(run)
run2_monitors = CloneWorkspace(run_monitors)
CloneWorkspace(run_monitors, OutputWorkspace="run2_monitors")
wb_ws = Rebin(run, Params=[tMin, 1, tMax], PreserveEvents=False)
......@@ -420,7 +421,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
def test_multirep_abs_units_mode(self):
# create test workspace
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, \
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1,
NumEvents=100000, XUnit='Energy', XMin=3, XMax=200, BinWidth=0.1)
LoadInstrument(run_monitors, InstrumentName='MARI', RewriteSpectraMap=True)
ConvertUnits(InputWorkspace='run_monitors', OutputWorkspace='run_monitors', Target='TOF')
......@@ -428,20 +429,20 @@ class DirectEnergyConversionTest(unittest.TestCase):
tof = run_monitors.dataX(3)
tMin = tof[0]
tMax = tof[-1]
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1, \
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1,
NumEvents=100000, XUnit='TOF', xMin=tMin, xMax=tMax)
LoadInstrument(run, InstrumentName='MARI', RewriteSpectraMap=True)
# build "monovanadium"
mono = CloneWorkspace(run)
mono_monitors = CloneWorkspace(run_monitors)
CloneWorkspace(run_monitors, OutputWorkspace="mono_monitors")
# build "White-beam"
wb_ws = Rebin(run, Params=[tMin, 1, tMax], PreserveEvents=False)
# build "second run" to ensure repeated execution
run2 = CloneWorkspace(run)
run2_monitors = CloneWorkspace(run_monitors)
CloneWorkspace(run_monitors, OutputWorkspace="run2_monitors")
# Run multirep
tReducer = DirectEnergyConversion(run.getInstrument())
......@@ -484,7 +485,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
def test_abs_multirep_with_bkg_and_bleed(self):
# create test workspace
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, \
run_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1,
NumEvents=100000, XUnit='Energy', XMin=3, XMax=200, BinWidth=0.1)
LoadInstrument(run_monitors, InstrumentName='MARI', RewriteSpectraMap=True)
ConvertUnits(InputWorkspace='run_monitors', OutputWorkspace='run_monitors', Target='TOF')
......@@ -492,7 +493,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
tof = run_monitors.dataX(3)
tMin = tof[0]
tMax = tof[-1]
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1, \
run = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event', NumBanks=8, BankPixelWidth=1,
NumEvents=100000, XUnit='TOF', xMin=tMin, xMax=tMax)
LoadInstrument(run, InstrumentName='MARI', RewriteSpectraMap=True)
AddSampleLog(run, LogName='gd_prtn_chrg', LogText='1.', LogType='Number')
......@@ -557,7 +558,7 @@ class DirectEnergyConversionTest(unittest.TestCase):
def test_sum_monitors(self):
# create test workspace
monitor_ws = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=6, BankPixelWidth=1, \
monitor_ws = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=6, BankPixelWidth=1,
NumEvents=100000, XUnit='Energy', XMin=3, XMax=200, BinWidth=0.1)
ConvertUnits(InputWorkspace=monitor_ws, OutputWorkspace='monitor_ws', Target='TOF')
......@@ -568,12 +569,11 @@ class DirectEnergyConversionTest(unittest.TestCase):
x_max = max(xx[0], xx[-1])
x_step = (x_max - x_min) / (len(xx) - 1)
monitor_ws = Rebin(monitor_ws, Params=[x_min, x_step, x_max])
monitor_ws = mtd['monitor_ws']
#
# keep this workspace for second test below -- clone and give
# special name for RunDescriptor to recognize as monitor workspace for
# fake data workspace we will provide.
_TMPmonitor_ws_monitors = CloneWorkspace(monitor_ws)
CloneWorkspace(monitor_ws, OutputWorkspace="_TMPmonitor_ws_monitors")
# Estimate energy from two monitors
ei, mon1_peak, mon1_index, tzero = \
......@@ -584,9 +584,9 @@ class DirectEnergyConversionTest(unittest.TestCase):
# Provide instrument parameter, necessary to define
# DirectEnergyConversion class properly
SetInstrumentParameter(monitor_ws, ParameterName='fix_ei', ParameterType='Number', Value='0')
SetInstrumentParameter(monitor_ws, DetectorList=[1, 2, 3, 6], ParameterName='DelayTime', \
SetInstrumentParameter(monitor_ws, DetectorList=[1, 2, 3, 6], ParameterName='DelayTime',
ParameterType='Number', Value='0.5')
SetInstrumentParameter(monitor_ws, ParameterName='mon2_norm_spec', \
SetInstrumentParameter(monitor_ws, ParameterName='mon2_norm_spec',
ParameterType='Number', Value='1')
# initiate test reducer
......
......@@ -34,7 +34,6 @@ class DirectPropertyManagerTest(unittest.TestCase):
@staticmethod
def getInstrument(InstrumentName='MAR'):
""" test method used to obtain default instrument for testing """
idf_dir = config.getString('instrumentDefinition.directory')
idf_file = api.ExperimentInfo.getInstrumentFilename(InstrumentName)
tmp_ws_name = '__empty_' + InstrumentName
if not mtd.doesExist(tmp_ws_name):
......@@ -491,8 +490,6 @@ class DirectPropertyManagerTest(unittest.TestCase):
SetInstrumentParameter(ws, ParameterName="addParam2", Value="Ignore2", ParameterType="String")
SetInstrumentParameter(ws, ParameterName="mask_run", Value="None", ParameterType="String")
old_changes = propman.getChangedProperties()
changed_prop = propman.update_defaults_from_instrument(ws.getInstrument())
self.assertEqual(len(changed_prop), 4)
......
......@@ -155,7 +155,6 @@ class ISISDirectInelasticConfigTest(unittest.TestCase):
self.assertEqual(user._recent_dateID, id)
self.assertEqual(user._start_dates['2000-01-12'], datetime.date(2000, 1, 12))
targetDir = self.get_save_dir()
rbdir = os.path.join(self.userRootDir, 'RB1999666')
if not os.path.exists(rbdir):
os.makedirs(rbdir)
......@@ -278,7 +277,7 @@ class ISISDirectInelasticConfigTest(unittest.TestCase):
user1.set_user_properties('MARI', rbdir2, 'CYCLE20991', '20990124')
mcf.init_user(user1)
source_file = self.makeFakeSourceReductionFile(mcf)
self.makeFakeSourceReductionFile(mcf)
mcf.generate_config()
self.assertEqual(len(mcf._dynamic_configuration), 6)
......
......@@ -24,7 +24,7 @@ class IndirectCommonTests(unittest.TestCase):
config['default.facility'] = 'ISIS'
def tearDown(self):
config = self._config_defaults
mantid.kernel.config = self._config_defaults
def test_getInstrRun_from_name(self):
ws = self.make_dummy_QENS_workspace()
......
......@@ -265,7 +265,7 @@ class ReduceMARI(ReductionWrapper):
if mpl is not None:
n_spectra = len(check_spectra)
if n_spectra == 0:
n_specra = corrections.getNumberHistograms()
n_spectra = corrections.getNumberHistograms()
mpl.plotSpectrum(corrections, range(0, n_spectra))
#
return corrections
......
......@@ -56,7 +56,6 @@ class QuickEditWidgetTest(unittest.TestCase):
def test_get_selection_all(self):
name = "All"
self.pres.widget.current_selection = mock.MagicMock(return_value=name)
output = self.widget.get_selection()
self.assertEqual(self.pres.all.call_count, 1)
def test_set_plot_x_range(self):
......
......@@ -173,7 +173,6 @@ class SubPlotContextTest(unittest.TestCase):
self.context.addLine(ws, 1)
self.context.addLine(ws2, 2)
lines = self.context.get_lines_from_WS_name("test")
expect = ["test"]
for key in expect:
self.assertIn(key, "test")
......
......@@ -334,7 +334,7 @@ class FFTPresenterTest(unittest.TestCase):
field_mock.assert_called_once_with(fft_mock_return)
self.presenter.add_fft_workspace_to_ADS.assert_called_once_with(name, Im_name, field_mock_return)
def test_selection_removed_genWorkspaceName(self):
def test_selection_removed_WorkspaceName(self):
# Remove first group from selection
self.remove_from_group_selection('top')
......
......@@ -100,7 +100,7 @@ class MaxEntPresenterTest(unittest.TestCase):
['MUSR22222_phase_table', 'MUSR33333_phase_table',
'EMU22222_phase_table']]
self.presenter.update_phase_table_options()
maxent_workspace = CreateWorkspace([0], [0])
CreateWorkspace([0], [0], OutputWorkspace="maxent_workspace")
self.presenter.add_maxent_workspace_to_ADS('MUSR22725_MaxEnt', 'maxent_workspace', mock.MagicMock())
......
......@@ -85,7 +85,6 @@ class PhaseTablePresenterTest(unittest.TestCase):
def test_that_phase_table_added_to_ADS_with_correct_name_and_group(self, mock_workspace_wrapper):
workspace_wrapper = mock.MagicMock()
mock_workspace_wrapper.return_value = workspace_wrapper
mock_phase_table = mock.MagicMock()
self.presenter.add_phase_table_to_ADS('MUSR22222_period_1; PhaseTable')
......
......@@ -66,7 +66,7 @@ class SeqFittingTabPresenterTest(unittest.TestCase):
def test_handle_fit_function_changed_correctly_updates_fit_table_parameters(self):
fit_values = [0.2, 0.2, 0.1, 0]
fit_function = self._setup_test_fit_function(fit_values)
self._setup_test_fit_function(fit_values)
self.view.fit_table.get_number_of_fits.return_value = 2
self.presenter.handle_fit_function_updated()
......@@ -93,7 +93,7 @@ class SeqFittingTabPresenterTest(unittest.TestCase):
def test_handle_fit_selected_correctly_sets_up_fit(self, mock_function_tools):
workspace = "EMU20884; Group; fwd; Asymmetry"
self.view.fit_table.get_selected_rows = mock.MagicMock(return_value=[0])
fit_function = self._setup_test_fit_function([0.2, 0.1, 0, 0])
self._setup_test_fit_function([0.2, 0.1, 0, 0])
self.presenter.get_workspaces_for_row_in_fit_table = mock.MagicMock(return_value=workspace)
self.presenter.handle_fit_selected_pressed()
......@@ -111,7 +111,7 @@ class SeqFittingTabPresenterTest(unittest.TestCase):
@mock.patch('Muon.GUI.Common.seq_fitting_tab_widget.seq_fitting_tab_presenter.functools')
def test_handle_fit_selected_pressed_does_nothing_if_no_fit_selected(self, mock_function_tools):
fit_function = self._setup_test_fit_function([0.2, 0.1, 0, 0])
self._setup_test_fit_function([0.2, 0.1, 0, 0])
self.view.fit_table.get_selected_rows = mock.MagicMock(return_value=[])
self.presenter.handle_fit_selected_pressed()
......@@ -135,7 +135,7 @@ class SeqFittingTabPresenterTest(unittest.TestCase):
def test_handle_sequential_fit_correctly_sets_up_fit(self, mock_function_tools):
workspaces = ["EMU20884; Group; fwd; Asymmetry"]
number_of_entries = 3
fit_function = self._setup_test_fit_function([0.2, 0.2, 0.1, 0])
self._setup_test_fit_function([0.2, 0.2, 0.1, 0])
self.view.fit_table.get_number_of_fits = mock.MagicMock(return_value=number_of_entries)
self.presenter.get_workspaces_for_row_in_fit_table = mock.MagicMock(return_value=workspaces)
......
......@@ -9,7 +9,6 @@ import unittest
from unittest import mock
from mantidqt.utils.qt.testing import start_qapplication
from Muon.GUI.Common.utilities import load_utils
from Muon.GUI.FrequencyDomainAnalysis.FFT import fft_presenter
from Muon.GUI.FrequencyDomainAnalysis.FFT.fft_widget import FFTWidget
from Muon.GUI.FrequencyDomainAnalysis.MaxEnt import maxent_presenter
......
......@@ -10,7 +10,6 @@ import unittest
from mantid import simpleapi, ConfigService
from mantid.api import AnalysisDataService, ITableWorkspace
from unittest import mock
def create_simple_workspace(data_x, data_y, run_number=0):
......@@ -77,7 +76,6 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(run, 22725)
def test_load_workspace_from_filename_for_file_path(self):
mock_alg = mock.MagicMock()
filename = 'PSI'+ os.sep + 'run_1529_templs0.mon'
inputs = {
"DeadTimeTable": "__notUsed",
......@@ -86,5 +84,6 @@ class MuonFileUtilsTest(unittest.TestCase):
alg, _ = utils.create_load_algorithm(filename,inputs)
self.assertTrue(filename in alg.getProperty("Filename").value)
if __name__ == '__main__':
unittest.main(buffer=False, verbosity=2)
......@@ -68,7 +68,7 @@ class MuonWorkspaceAddDirectoryTest(unittest.TestCase):
# ----------------------------------------------------------------------------------------------
def test_that_if_workspace_exists_with_same_name_as_group_then_it_is_replaced(self):
group = simpleapi.CreateWorkspace([1, 2, 3, 4], [10, 10, 10, 10])
simpleapi.CreateWorkspace([1, 2, 3, 4], [10, 10, 10, 10], OutputWorkspace="group")
workspace_handle = MuonWorkspaceWrapper('group')
workspace_handle.show("group/ws1")
......
......@@ -26,7 +26,7 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase):
def test_cleanup(self):
numObjectsOriginal = len(mtd.getObjectNames())
todump = CreateSingleValuedWorkspace(OutputWorkspace='_toremove', DataValue=1, ErrorValue=1)
CreateSingleValuedWorkspace(OutputWorkspace='_toremove', DataValue=1, ErrorValue=1)
tokeep = CreateSingleValuedWorkspace(OutputWorkspace='tokeep', DataValue=1, ErrorValue=1)
self.assertEqual(numObjectsOriginal + 2, len(mtd.getObjectNames()))
# Should remove workspaces starting with _
......
......@@ -23,7 +23,7 @@ class RunDescriptorTest(unittest.TestCase):
return super(RunDescriptorTest, self).__init__(methodName)
def setUp(self):
if self.prop_man == None or type(self.prop_man) != type(PropertyManager):
if self.prop_man is None or type(self.prop_man) != type(PropertyManager):
self.prop_man = PropertyManager("MAR")
def tearDown(self):
......@@ -32,7 +32,6 @@ class RunDescriptorTest(unittest.TestCase):
@staticmethod
def getInstrument(InstrumentName='MAR'):
""" test method used to obtain default instrument for testing """
idf_dir = config.getString('instrumentDefinition.directory')
idf_file = api.ExperimentInfo.getInstrumentFilename(InstrumentName)
tmp_ws_name = '__empty_' + InstrumentName
if not mtd.doesExist(tmp_ws_name):
......@@ -91,11 +90,11 @@ class RunDescriptorTest(unittest.TestCase):
self.assertGreater(len(file), 0)
ext = PropertyManager.sample_run.get_fext()
self.assertEqual(ext, '.raw')
self.assertEqual(ext.casefold(), '.raw'.casefold())
PropertyManager.sample_run.set_file_ext('nxs')
ext = PropertyManager.sample_run.get_fext()
self.assertEqual(ext, '.nxs')
self.assertEqual(ext.casefold(), '.nxs'.casefold())
test_dir = config.getString('defaultsave.directory')
......@@ -245,9 +244,8 @@ class RunDescriptorTest(unittest.TestCase):
ws = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, NumEvents=100, XUnit='TOF',
XMin=2000, XMax=20000, BinWidth=1)
ws_monitors = CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, NumEvents=100,
XUnit='TOF',
XMin=2000, XMax=20000, BinWidth=1)
CreateSampleWorkspace(Function='Multiple Peaks', NumBanks=4, BankPixelWidth=1, NumEvents=100,
XUnit='TOF', XMin=2000, XMax=20000, BinWidth=1, OutputWorkspace="ws_monitors")
propman.sample_run = ws
......@@ -563,15 +561,15 @@ class RunDescriptorTest(unittest.TestCase):
wksp = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Event',
NumBanks=1, BankPixelWidth=1, NumEvents=1, XUnit='TOF',
XMin=2000, XMax=20000, BinWidth=1)
wksp_monitors = CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Histogram',
NumBanks=3, BankPixelWidth=1, NumEvents=1, XUnit='TOF',
XMin=2000, XMax=20000, BinWidth=1)
CreateSampleWorkspace(Function='Multiple Peaks', WorkspaceType='Histogram',
NumBanks=3, BankPixelWidth=1, NumEvents=1, XUnit='TOF',
XMin=2000, XMax=20000, BinWidth=1, OutputWorkspace="wksp_monitors")
propman = self.prop_man
propman.sample_run = wksp
try:
mon_ws = wksp.getMonitorWorkspace()
wksp.getMonitorWorkspace()
except:
self.fail()
......
......@@ -211,7 +211,6 @@ class SANS2DMoveTest(unittest.TestCase):
# All detectors are moved on SANS2D
component = None
move_type = MoveTypes.INITIAL_MOVE
move_info = _get_state_move_obj(SANSInstrument.SANS2D, z_translation=lab_z_translation_correction)
move_component(component_name=component, workspace=workspace, move_info=move_info,
......
......@@ -12,7 +12,6 @@ from fake_signal import FakeSignal
from mantid.kernel import ConfigService
from unittest import mock
from sans.common.enums import SANSInstrument
from sans.gui_logic.models import SumRunsModel
from sans.gui_logic.models.SumRunsModel import SumRunsModel
from sans.gui_logic.models.SummationSettingsModel import SummationSettingsModel
from sans.gui_logic.models.run_file import SummableRunFile
......@@ -81,7 +80,7 @@ class InitializationTest(AddRunsPagePresenterTestCase):
@mock.patch('sans.gui_logic.presenter.add_runs_presenter.SummationSettingsModel', autospec=True)
@mock.patch('sans.gui_logic.presenter.add_runs_presenter.SummationSettingsPresenter', autospec=True)
def test_creates_run_selector_with_child_view(self, patched_presenter, patched_model):
def test_creates_run_selector_summation_model_with_child_view(self, patched_presenter, patched_model):
view = self._make_mock_view()
parent_view = self._make_mock_parent_view()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment