Skip to content

Commit

Permalink
MaskAngle tests. Refs #8626
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Dec 18, 2013
1 parent 467eb09 commit bfc883e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Expand Up @@ -24,7 +24,6 @@ def name(self):
return "MaskAngle"

def PyInit(self):
instvalid=
self.declareProperty(mantid.api.WorkspaceProperty("Workspace", "",direction=mantid.kernel.Direction.Input,validator=mantid.api.InstrumentValidator()), "Input workspace")
angleValidator=mantid.kernel.FloatBoundedValidator()
angleValidator.setBounds(0.,180.)
Expand Down
Expand Up @@ -18,6 +18,42 @@ def testMaskAngle(self):
DeleteWorkspace(w)
self.assertTrue(array_equal(masklist,arange(10)+10))


def testFailNoInstrument(self):
w1=CreateWorkspace(arange(5),arange(5))
try:
MaskAngle(w1,10,20)
self.fail("Should not have got here. Should throw because no instrument.")
except ValueError:
pass
finally:
DeleteWorkspace(w1)

def testFailLimits(self):
w2=WorkspaceCreationHelper.create2DWorkspaceWithFullInstrument(30,5,False,False)
AnalysisDataService.add('w2',w2)
w3=CloneWorkspace('w2')
w4=CloneWorkspace('w2')
try:
MaskAngle(w2,-100,20)
self.fail("Should not have got here. Wrong angle.")
except ValueError:
pass
finally:
DeleteWorkspace('w2')
try:
MaskAngle(w3,10,200)
self.fail("Should not have got here. Wrong angle.")
except ValueError:
pass
finally:
DeleteWorkspace('w3')
try:
MaskAngle(w4,100,20)
self.fail("Should not have got here. Wrong angle.")
except RuntimeError:
pass
finally:
DeleteWorkspace('w4')

if __name__ == '__main__':
unittest.main()

0 comments on commit bfc883e

Please sign in to comment.