Skip to content

Commit

Permalink
Working on build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joleroi committed Sep 30, 2015
1 parent 37bec4f commit 512c85f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gammapy/scripts/tests/test_spectrum_pipe.py
Expand Up @@ -2,7 +2,8 @@
from numpy.testing import assert_equal, assert_almost_equal
from astropy.io import fits
from astropy.tests.helper import remote_data
from gammapy.scripts import GammapySpectrumAnalysis
from astropy.tests.helper import pytest
from ...scripts import GammapySpectrumAnalysis
from ...datasets import get_path

try:
Expand Down
3 changes: 2 additions & 1 deletion gammapy/spectrum/energy.py
Expand Up @@ -5,6 +5,7 @@
from astropy.io import fits
from astropy import log
from astropy.table import Table
from astropy.extern import six
from ..utils.fits import table_to_fits_table


Expand Down Expand Up @@ -45,7 +46,7 @@ def __new__(cls, energy, unit=None, dtype=None, copy=True):
# Techniques to subclass Quantity taken from astropy.coordinates.Angle
# see: http://docs.scipy.org/doc/numpy/user/basics.subclassing.html

if isinstance(energy, basestring):
if isinstance(energy, six.string_types):
val, unit = energy.split()
energy = float(val)

Expand Down
5 changes: 5 additions & 0 deletions gammapy/spectrum/tests/test_energy.py
Expand Up @@ -66,6 +66,11 @@ def test_Energy():
desired = Energy(10, 'TeV')
assert_equal(actual, desired)

e_string = u'10 TeV'
actual = Energy(e_string)
desired = Energy(10, 'TeV')
assert_equal(actual, desired)


@remote_data
def test_EnergyBounds():
Expand Down

0 comments on commit 512c85f

Please sign in to comment.