Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-v0.8.x' into stable
# Conflicts: # doc/conf.py # megaradrp/__init__.py # setup.py
- Loading branch information
Showing
15 changed files
with
155 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
import logging | ||
|
||
|
||
__version__ = '0.7.1' | ||
__version__ = '0.8' | ||
|
||
|
||
# Top level NullHandler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
import pytest | ||
|
||
import megaradrp.requirements as reqs | ||
import numina.core | ||
import numina.dal | ||
from numina.exceptions import NoResultFound | ||
|
||
|
||
class IoInstance(object): | ||
_numina_desc_val = {} | ||
|
||
|
||
class LocalDal(object): | ||
def __init__(self): | ||
self.filename = "some_file.txt" | ||
|
||
def search_product(self, name, tipo, obsres, options=None): | ||
if obsres.id == 1: | ||
return numina.dal.StoredProduct(1, self.filename, tags={}) | ||
if obsres.id == 2: | ||
return numina.dal.StoredProduct(1, None, tags={}) | ||
elif obsres.id == 0: | ||
raise NoResultFound('Nothing') | ||
else: | ||
sp = None | ||
return sp | ||
|
||
|
||
@pytest.mark.parametrize('obsid', [0, 1, 2]) | ||
def test_extinction_none(obsid): | ||
|
||
name = "reference_extinction" | ||
reference_extinction = reqs.ReferenceExtinction() | ||
reference_extinction.dest = name | ||
|
||
dal = LocalDal() | ||
|
||
obs = numina.core.ObservationResult() | ||
obs.id = obsid | ||
obs.requirements = {name: None} | ||
value = reference_extinction.query(dal, obs) | ||
instance = IoInstance() | ||
|
||
reference_extinction.__set__(instance, value) | ||
cval = instance._numina_desc_val[name] | ||
assert cval is None | ||
|
||
|
||
def _test_extinction_filename(): | ||
|
||
name = "reference_extinction" | ||
reference_extinction = reqs.ReferenceExtinction() | ||
reference_extinction.dest = name | ||
|
||
dal = LocalDal() | ||
|
||
obs = numina.core.ObservationResult() | ||
|
||
import tempfile, os, numpy | ||
|
||
arr = numpy.array([1.0,2.0,3.0,4.0]) | ||
fd, path = tempfile.mkstemp() | ||
try: | ||
#obs.requirements = {name: path} | ||
numpy.savetxt(path, arr) | ||
|
||
value = reference_extinction.query(dal, obs) | ||
instance = IoInstance() | ||
|
||
reference_extinction.__set__(instance, value) | ||
cval = instance._numina_desc_val[name] | ||
assert numpy.allclose(cval, arr) | ||
assert False | ||
finally: | ||
os.remove(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.