Skip to content

Commit

Permalink
Ensures MantidPlot runs with python's builtin range command by default
Browse files Browse the repository at this point in the history
Adds a test for specifically passing a range to plotSpectrum.
Refs mantidproject#18746
  • Loading branch information
martyngigg committed Feb 8, 2017
1 parent 1285d40 commit 9f00b00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions MantidPlot/mantidplotrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
# Import MantidPlot python commands
import mantidplot
from mantidplot import *
try:
# The MantidPlot namespace is not ready for the python3-style range function
# so we ensure we revert back to the current built-in version
del range
except NameError:
pass

# Make Mantid available
import mantid
Expand Down
5 changes: 4 additions & 1 deletion MantidPlot/test/MantidPlot1DPlotTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def test_plotSpectrum_severalSpectra(self):
g = plotSpectrum("fake", [0, 1])
self.g = g

def test_plotSpectrum_range_command(self):
g = plotSpectrum("fake", range(0, 2))
self.g = g

def test_Customized1DPlot(self):
g = plotSpectrum("fake", 0, error_bars=True)
l = g.activeLayer()
Expand Down Expand Up @@ -110,4 +114,3 @@ def test_plotBin_command_with_tuple(self):

# Run the unit tests
mantidplottests.runTests(MantidPlot1DPlotTest)

0 comments on commit 9f00b00

Please sign in to comment.