Add test for from_geom method.
@@ -4,7 +4,12 @@ import pytest
from astropy.coordinates import SkyCoord
from collections import OrderedDict
from ..base import Map
-from ..geom import MapAxis
+from ..geom import MapGeom, MapAxis
+from ..wcs import WcsGeom
+from ..wcsnd import WcsNDMap
+from ..hpx import HpxGeom
+from ..hpxnd import HpxNDMap
+
pytest.importorskip('scipy')
pytest.importorskip('healpy')
@@ -30,11 +35,20 @@ mapbase_args = [
@pytest.mark.parametrize(('binsz', 'width', 'map_type', 'skydir', 'axes'),
mapbase_args)
-def test_mapbase_create(binsz, width, map_type, skydir, axes):
+def test_map_create(binsz, width, map_type, skydir, axes):
m = Map.create(binsz=binsz, width=width, map_type=map_type,
skydir=skydir, axes=axes)
+def test_map_from_geom():
+ geom = WcsGeom.create(binsz=1.0, width=10.0)
+ m = Map.from_geom(geom)
+ assert(isinstance(m, WcsNDMap))
+ geom = HpxGeom.create(binsz=1.0, width=10.0)
+ m = Map.from_geom(geom)
+ assert(isinstance(m, HpxNDMap))
+
+
@pytest.mark.parametrize('map_type', ['wcs', 'hpx', 'hpx-sparse'])
def test_map_meta_read_write(map_type):
meta = OrderedDict([
