Skip to content

Commit

Permalink
fix 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Sep 6, 2017
1 parent 0c7abc8 commit 7a77e02
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ matrix:

include:
# Try MacOS X
- os: osx
env: SETUP_CMD='test'
#- os: osx
# env: SETUP_CMD='test'

# Do a coverage test.
- os: linux
Expand All @@ -73,9 +73,9 @@ matrix:
- os: linux
env: PYTHON_VERSION=2.7 ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'
#- os: linux
# env: ASTROPY_VERSION=development
# EVENT_TYPE='pull_request push cron'
- os: linux
env: ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'
#- os: linux
# env: PYTHON_VERSION=2.7 ASTROPY_VERSION=lts
#- os: linux
Expand Down
5 changes: 2 additions & 3 deletions linetools/lists/linelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def set_extra_columns_to_datatable(self, abundance_type='solar', ion_correction=
"""
# Avoid redo (especially for caching)
if ('ion_name' in self._data.keys()) and (not redo):
if ('ion_name' in self._data.keys()) and (redo is False):
return

if self.list not in ['HI', 'ISM', 'EUV', 'Strong', 'H2']:
Expand Down Expand Up @@ -422,8 +422,7 @@ def set_extra_columns_to_datatable(self, abundance_type='solar', ion_correction=

# Set Abundance
if abundance_type not in ['none', 'solar']:
raise ValueError('set_extra_columns_to_datatable: `abundance type` '
'has to be either: `none` or `solar`')
raise ValueError('set_extra_columns_to_datatable: `abundance type` has to be either: `none` or `solar`')
if abundance_type == 'none':
self._data['abundance'] = np.zeros(len(self._data))
elif abundance_type == 'solar':
Expand Down
13 changes: 7 additions & 6 deletions linetools/lists/tests/test_init_linelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_unknown():
unknown = ism.unknown_line()
assert unknown['name'] == 'unknown', 'There is a problem in the LineList.unknown_line()'
assert unknown['wrest'] == 0.*u.AA, 'There is a problem in the LineList.unknown_line()'
print(ism['unknown'])

def test_mk_sets():
import imp
Expand All @@ -89,13 +88,15 @@ def test_mk_sets():


def test_set_extra_columns_to_datatable():
ism = LineList('ISM')
# bad calls
with pytest.raises(ValueError):
ism.set_extra_columns_to_datatable(abundance_type='incorrect_one')
with pytest.raises(ValueError):
ism.set_extra_columns_to_datatable(ion_correction='incorrect_one', redo=True)
#ism = LineList('ISM')
#with pytest.raises(ValueError) as tmp: # This is failing Python 2.7 for reasons unbenknownst to me
# ism.set_extra_columns_to_datatable(abundance_type='incorrect_one')
#ism = LineList('ISM')
#with pytest.raises(ValueError):
# ism.set_extra_columns_to_datatable(ion_correction='incorrect_one', redo=True)
# test expected strongest value
ism = LineList('ISM')
ism.set_extra_columns_to_datatable(ion_correction='none', abundance_type='solar', redo=True)
np.testing.assert_allclose(ism['HI 1215']['rel_strength'], 14.704326420257642)
tab = ism._data
Expand Down

0 comments on commit 7a77e02

Please sign in to comment.