Example #1
0
 def test_query_zero_sized_region(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_region(SkyCoord("20h54m05.6889s 37d01m17.380s"), radius="1s",
                                  equinox=2000.0, epoch='J2000')
     # This should find a single star, BD+36 4308
     assert len(result) == 1
Example #2
0
 def test_query_bibobj(self, temp_dir):
     simbad = Simbad()
     simbad.ROW_LIMIT = 5
     simbad.cache_location = temp_dir
     result = simbad.query_bibobj('2005A&A.430.165F')
     assert isinstance(result, Table)
     assert len(result) == 5
Example #3
0
    def test_query_object_ids(self, temp_dir):
        simbad = Simbad()
        simbad.cache_location = temp_dir
        result = simbad.query_objectids("Polaris")

        # Today, there are 42 names.  There could be more in the future
        assert len(result) >= 42
Example #4
0
 def test_query_small_region_null(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_region(SkyCoord("00h01m0.0s 00h00m0.0s"),
                                  radius=1.0 * u.marcsec,
                                  equinox=2000.0,
                                  epoch='J2000')
     assert result is None
Example #5
0
 def test_query_region(self, temp_dir):
     simbad = Simbad()
     # TODO: rewise once ROW_LIMIT is working
     simbad.TIMEOUT = 100
     simbad.cache_location = temp_dir
     result = simbad.query_region(ICRS_COORDS_M42, radius=2 * u.deg,
                                  equinox=2000.0, epoch='J2000')
     assert isinstance(result, Table)
Example #6
0
 def test_query_regions(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_region(multicoords,
                                  radius=1 * u.arcmin,
                                  equinox=2000.0,
                                  epoch='J2000')
     assert isinstance(result, Table)
Example #7
0
    def test_query_region_async(self, temp_dir):
        simbad = Simbad()
        # TODO: rewise once ROW_LIMIT is working
        simbad.TIMEOUT = 100
        simbad.cache_location = temp_dir
        response = simbad.query_region_async(
            ICRS_COORDS_M42, radius=2 * u.deg, equinox=2000.0, epoch='J2000')

        assert response is not None
Example #8
0
 def test_query_bibcode_async(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     response = simbad.query_bibcode_async('2006ApJ*', wildcard=True)
     assert response is not None
     response.raise_for_status()
     # make sure requests has *NOT* been monkeypatched
     assert hasattr(response, 'connection')
     assert hasattr(response, 'close')
     assert hasattr(response, 'status_code')
     assert hasattr(response, 'request')
     assert not isinstance(response, MockResponse)
     assert not issubclass(response.__class__, MockResponse)
Example #9
0
    def test_query_multi_object(self, temp_dir):
        simbad = Simbad()
        simbad.cache_location = temp_dir
        result = simbad.query_objects(['M32', 'M81'])
        assert len(result) == 2
        assert len(result.errors) == 0

        result = simbad.query_objects(['M32', 'M81', 'gHer'])
        # 'gHer' is not a valid Simbad identifier - it should be 'g Her' to
        # get the star
        assert len(result) == 2
        assert len(result.errors) == 1

        # test async
        s = Simbad()
        response = s.query_objects_async(['M32', 'M81'])

        result = s._parse_result(response, SimbadVOTableResult)
        assert len(result) == 2
Example #10
0
 def test_query_objects_null(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     assert simbad.query_objects(['idonotexist', 'idonotexisteither']) is None
Example #11
0
 def test_query_catalog(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_catalog('m')
     assert isinstance(result, Table)
Example #12
0
 def test_query_catalog_async(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     response = simbad.query_catalog_async('m')
     assert response is not None
Example #13
0
 def test_query_bibobj_async(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     response = simbad.query_bibobj_async('2006AJ....131.1163S')
     assert response is not None
Example #14
0
 def test_non_ascii_bibcode(self, temp_dir):
     # regression test for #1775
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_bibcode('2019PASJ...71...55K')
     assert len(result) > 0
Example #15
0
 def test_query_bibcode(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_bibcode('2006ApJ*', wildcard=True)
     assert isinstance(result, Table)
Example #16
0
 def test_query_criteria2(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_criteria(otype='SNR')
     assert isinstance(result, Table)
Example #17
0
 def test_query_criteria1(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_criteria(
         "region(box, GAL, 49.89 -0.3, 0.5d 0.5d)", otype='HII')
     assert isinstance(result, Table)
Example #18
0
 def test_query_region_async_vector(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     response1 = simbad.query_region_async(multicoords, radius=0.5*u.arcsec)
     assert response1.request.body == 'script=votable+%7Bmain_id%2Ccoordinates%7D%0Avotable+open%0Aquery+coo+5%3A35%3A17.3+-80%3A52%3A00+radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Aquery+coo+17%3A47%3A20.4+-28%3A23%3A07.008+radius%3D0.5s+frame%3DICRS+equi%3D2000.0%0Avotable+close'   # noqa
Example #19
0
 def test_query_object_async(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     response = simbad.query_object_async("m [0-9]", wildcard=True)
     assert response is not None
Example #20
0
 def test_null_response(self, temp_dir, function):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     assert (simbad.__getattribute__(function)('idonotexist')
             is None)
Example #21
0
 def test_query_object(self, temp_dir):
     simbad = Simbad()
     simbad.cache_location = temp_dir
     result = simbad.query_object("m [0-9]", wildcard=True)
     assert isinstance(result, Table)