Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
b4b3b510
Commit
b4b3b510
authored
Jul 18, 2013
by
Owen Arnold
Browse files
refs #7472. New unit test script.
Covering cleanup and starting work on coAdd.
parent
364fbc43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/scripts/CMakeLists.txt
View file @
b4b3b510
set
(
TEST_PY_FILES test/ReducerTest.py
)
set
(
TEST_PY_FILES test/ReducerTest.py
test/ReflectometryQuickAuxiliaryTest.py
)
# python unit tests
if
(
PYUNITTEST_FOUND
)
...
...
Code/Mantid/scripts/Reflectometry/isis_reflgui/quick.py
View file @
b4b3b510
...
...
@@ -12,8 +12,6 @@ from l2q import *
from
combineMulti
import
*
#from mantidsimple import * # Old API
from
mantid.simpleapi
import
*
# New API
from
mantidplot
import
*
from
PyQt4
import
QtCore
,
uic
from
mantid.api
import
WorkspaceGroup
import
math
import
re
...
...
Code/Mantid/scripts/test/ReflectometryQuickAuxiliaryTest.py
0 → 100644
View file @
b4b3b510
import
unittest
from
MantidFramework
import
mtd
mtd
.
initialise
()
from
mantid.simpleapi
import
*
from
isis_reflgui
import
quick
class
ReflectometryQuickAuxiliaryTest
(
unittest
.
TestCase
):
def
test_cleanup
(
self
):
todump
=
CreateSingleValuedWorkspace
(
OutputWorkspace
=
'_toremove'
,
DataValue
=
1
,
ErrorValue
=
1
)
tokeep
=
CreateSingleValuedWorkspace
(
OutputWorkspace
=
'tokeep'
,
DataValue
=
1
,
ErrorValue
=
1
)
self
.
assertEqual
(
2
,
len
(
mtd
.
getObjectNames
()))
# Should remove workspaces starting with _
quick
.
cleanup
()
cleaned_object_names
=
mtd
.
getObjectNames
()
self
.
assertEqual
(
1
,
len
(
cleaned_object_names
))
self
.
assertEqual
(
True
,
(
'tokeep'
in
cleaned_object_names
))
def
test_coAdd_ws_in_ADS
(
self
):
inWS
=
CreateSingleValuedWorkspace
(
DataValue
=
1
,
ErrorValue
=
1
)
quick
.
coAdd
(
'inWS'
,
'ProvidedName'
)
outWS
=
mtd
[
'_WProvidedName'
]
result
=
CheckWorkspacesMatch
(
Workspace1
=
inWS
,
Workspace2
=
outWS
)
self
.
assertEquals
(
"Success!"
,
result
)
def
test_coAdd_run_list
(
self
):
originalInstrument
=
config
.
getInstrument
()
try
:
# We have multiple runs from some MUSR files in AutoTest, lets use those.
tempInstrument
=
"MUSR"
config
[
'default.instrument'
]
=
tempInstrument
runlist
=
'15189, 15190'
# Run coAdd
quick
.
coAdd
(
runlist
,
'ProvidedName'
)
# Get the output workspace and do some quick sanity checks
outWS
=
mtd
[
'_WProvidedName'
]
self
.
assertEquals
(
outWS
[
0
].
getInstrument
().
getName
(),
tempInstrument
)
# Perform the addition of the two files manually
a
=
LoadMuonNexus
(
Filename
=
'15189'
)
b
=
LoadMuonNexus
(
Filename
=
'15190'
)
c
=
Plus
(
LHSWorkspace
=
a
[
0
],
RHSWorkspace
=
b
[
0
])
#Check the expected calculated result against coAdd
result
=
CheckWorkspacesMatch
(
Workspace1
=
c
,
Workspace2
=
outWS
)
self
.
assertEquals
(
"Success!"
,
result
)
finally
:
config
[
'default.instrument'
]
=
originalInstrument
.
name
()
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment