diff --git a/docs/registry/index.rst b/docs/registry/index.rst index 030aa32d4..96a8abf3b 100644 --- a/docs/registry/index.rst +++ b/docs/registry/index.rst @@ -369,8 +369,8 @@ RegTAP services using: ... for r in res))) http://dc.zah.uni-heidelberg.de/tap http://gavo.aip.de/tap - http://vao.stsci.edu/RegTAP/TapService.aspx http://voparis-rr.obspm.fr:80/tap + https://vao.stsci.edu/RegTAP/TapService.aspx diff --git a/pyvo/dal/tests/test_tap.py b/pyvo/dal/tests/test_tap.py index 68077788b..5b0607e79 100644 --- a/pyvo/dal/tests/test_tap.py +++ b/pyvo/dal/tests/test_tap.py @@ -751,21 +751,21 @@ def test_missing_featurelist(self, tapservice): def test_get_featurelist(self, tapservice): features = tapservice.get_tap_cap().get_adql().get_feature_list( - "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo") + "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo") assert set(f.form for f in features) == { - 'CENTROID', 'CONTAINS', 'COORD1', 'POLYGON', - 'INTERSECTS', 'COORD2', 'BOX', 'AREA', 'DISTANCE', - 'REGION', 'CIRCLE', 'POINT'} + 'CENTROID', 'CONTAINS', 'COORD1', 'POLYGON', + 'INTERSECTS', 'COORD2', 'BOX', 'AREA', 'DISTANCE', + 'REGION', 'CIRCLE', 'POINT'} def test_get_missing_feature(self, tapservice): assert tapservice.get_tap_cap().get_adql().get_feature( - "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo", - "Garage") == None + "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo", + "Garage") == None def test_get_feature(self, tapservice): feature = tapservice.get_tap_cap().get_adql().get_feature( - "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo", - "AREA") + "ivo://ivoa.net/std/TAPRegExt#features-adqlgeo", + "AREA") assert feature.form == "AREA" assert feature.description == None diff --git a/pyvo/registry/rtcons.py b/pyvo/registry/rtcons.py index 7e844f418..b2ea7badf 100644 --- a/pyvo/registry/rtcons.py +++ b/pyvo/registry/rtcons.py @@ -245,7 +245,7 @@ def _get_union_condition(self, service): "SELECT ivoid FROM rr.resource WHERE" " 1=ivo_hasword(res_title, {{{parname}}})", "SELECT ivoid FROM rr.res_subject WHERE" - " res_subject ILIKE {{{parpatname}}}"] + " rr.res_subject.res_subject ILIKE {{{parpatname}}}"] self._fillers, subqueries = {}, [] for index, word in enumerate(self.words): @@ -266,7 +266,7 @@ def _get_or_condition(self, service): base_queries = [ " 1=ivo_hasword(res_description, {{{parname}}})", " 1=ivo_hasword(res_title, {{{parname}}})", - " res_subject ILIKE {{{parpatname}}}"] + " rr.res_subject.res_subject ILIKE {{{parpatname}}}"] self._fillers, conditions = {}, [] for index, word in enumerate(self.words): @@ -660,7 +660,7 @@ def get_search_condition(self, service): # something as esoteric as a server that understands # MOC-based geometries but does not have a MOC function. if not service.get_tap_cap().get_adql().get_feature( - "ivo://org.gavo.dc/std/exts#extra-adql-keywords", "MOC"): + "ivo://org.gavo.dc/std/exts#extra-adql-keywords", "MOC"): raise RegTAPFeatureMissing("Current RegTAP service" " does not support MOC.") diff --git a/pyvo/registry/tests/commonfixtures.py b/pyvo/registry/tests/commonfixtures.py index 27b5c5b4a..9b0a63d70 100644 --- a/pyvo/registry/tests/commonfixtures.py +++ b/pyvo/registry/tests/commonfixtures.py @@ -65,7 +65,7 @@ def get_tap_cap(self): FAKE_GAVO = _FakeTAPService({ - ("ivo://ivoa.net/std/TAPRegExt#features-adql-sets", "UNION"), + ("ivo://ivoa.net/std/TAPRegExt#features-adql-sets", "UNION"), ("ivo://org.gavo.dc/std/exts#extra-adql-keywords", "MOC"), }, { "rr.stc_spatial": None, diff --git a/pyvo/registry/tests/test_regtap.py b/pyvo/registry/tests/test_regtap.py index 18430f9a9..1bda7b6cd 100644 --- a/pyvo/registry/tests/test_regtap.py +++ b/pyvo/registry/tests/test_regtap.py @@ -69,7 +69,7 @@ def keywordstest_callback(request, context): assert "ivo_hasword(res_description, 'vizier')" in query assert "1=ivo_hasword(res_title, 'vizier')" in query - assert " res_subject ILIKE '%pulsar%'" in query + assert ".res_subject ILIKE '%pulsar%'" in query assert "1=ivo_hasword(res_description, 'pulsar')" in query assert "1=ivo_hasword(res_title, 'pulsar')" in query @@ -88,7 +88,7 @@ def keywordstest_callback(request, context): data = dict(parse_qsl(request.body)) query = data['QUERY'] - assert "OR res_subject ILIKE '%single%'" in query + assert "OR rr.res_subject.res_subject ILIKE '%single%'" in query assert "1=ivo_hasword(res_description, 'single') " in query assert "1=ivo_hasword(res_title, 'single')" in query @@ -840,6 +840,7 @@ def test_sia2_service_operation(): assert "s_dec" in res.to_table().columns +@pytest.mark.remote_data def test_endpoint_switching(): alt_svc = "http://vao.stsci.edu/RegTAP/TapService.aspx" previous_url = regtap.REGISTRY_BASEURL diff --git a/pyvo/registry/tests/test_rtcons.py b/pyvo/registry/tests/test_rtcons.py index 0aa03d092..ba8ca8f43 100644 --- a/pyvo/registry/tests/test_rtcons.py +++ b/pyvo/registry/tests/test_rtcons.py @@ -78,30 +78,30 @@ def test_basic(self): assert rtcons.Freetext("star").get_search_condition(FAKE_GAVO) == ( "ivoid IN (SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_description, 'star') " "UNION SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_title, 'star') " - "UNION SELECT ivoid FROM rr.res_subject WHERE res_subject ILIKE '%star%')") + "UNION SELECT ivoid FROM rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%star%')") def test_interesting_literal(self): assert rtcons.Freetext("α Cen's planets").get_search_condition(FAKE_GAVO) == ( "ivoid IN (SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_description, 'α Cen''s planets')" " UNION SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_title, 'α Cen''s planets')" - " UNION SELECT ivoid FROM rr.res_subject WHERE res_subject ILIKE '%α Cen''s planets%')") + " UNION SELECT ivoid FROM rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%α Cen''s planets%')") def test_multipleLiterals(self): assert rtcons.Freetext("term1", "term2" ).get_search_condition(FAKE_GAVO) == ( "ivoid IN (SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_description, 'term1')" " UNION SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_title, 'term1')" - " UNION SELECT ivoid FROM rr.res_subject WHERE res_subject ILIKE '%term1%')" + " UNION SELECT ivoid FROM rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%term1%')" " AND " "ivoid IN (SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_description, 'term2')" " UNION SELECT ivoid FROM rr.resource WHERE 1=ivo_hasword(res_title, 'term2')" - " UNION SELECT ivoid FROM rr.res_subject WHERE res_subject ILIKE '%term2%')") + " UNION SELECT ivoid FROM rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%term2%')") def test_adaption_to_service(self): assert rtcons.Freetext("term1", "term2" ).get_search_condition(FAKE_PLAIN) == ( - "( 1=ivo_hasword(res_description, 'term1') OR 1=ivo_hasword(res_title, 'term1') OR res_subject ILIKE '%term1%')" - " AND ( 1=ivo_hasword(res_description, 'term2') OR 1=ivo_hasword(res_title, 'term2') OR res_subject ILIKE '%term2%')") + "( 1=ivo_hasword(res_description, 'term1') OR 1=ivo_hasword(res_title, 'term1') OR rr.res_subject.res_subject ILIKE '%term1%')" + " AND ( 1=ivo_hasword(res_description, 'term2') OR 1=ivo_hasword(res_title, 'term2') OR rr.res_subject.res_subject ILIKE '%term2%')") class TestAuthorConstraint: @@ -253,14 +253,14 @@ def test_SkyCoord_Circle(self): assert cons._extra_tables == ["rr.stc_spatial"] def test_no_MOC(self): - cons = registry.Spatial((SkyCoord(3 * units.deg, -30 * units.deg), 3)) + cons = registry.Spatial((SkyCoord(3 * u.deg, -30 * u.deg), 3)) with pytest.raises(rtcons.RegTAPFeatureMissing) as excinfo: cons.get_search_condition(FAKE_PLAIN) assert (str(excinfo.value) == "Current RegTAP service does not support MOC.") def test_no_spatial_table(self): - cons = registry.Spatial((SkyCoord(3 * units.deg, -30 * units.deg), 3)) + cons = registry.Spatial((SkyCoord(3 * u.deg, -30 * u.deg), 3)) previous = FAKE_GAVO.tables.pop("rr.stc_spatial") try: with pytest.raises(rtcons.RegTAPFeatureMissing) as excinfo: @@ -310,7 +310,7 @@ def test_frequency_interval(self): " 5.830941732e-26, 6.758591553e-26)") def test_no_spectral(self): - cons = registry.Spectral((88 * units.MHz, 102 * units.MHz)) + cons = registry.Spectral((88 * u.MHz, 102 * u.MHz)) with pytest.raises(rtcons.RegTAPFeatureMissing) as excinfo: cons.get_search_condition(FAKE_PLAIN) assert (str(excinfo.value) @@ -341,15 +341,14 @@ def test_multi_times_rejected(self): " be made from single time instants.") def test_no_temporal(self): - cons = registry.Temporal((time.Time(2459000, format='jd'), - time.Time(59002, format='mjd'))) + cons = registry.Temporal((Time(2459000, format='jd'), + Time(59002, format='mjd'))) with pytest.raises(rtcons.RegTAPFeatureMissing) as excinfo: cons.get_search_condition(FAKE_PLAIN) assert (str(excinfo.value) == "stc_temporal missing on current RegTAP service") - class TestWhereClauseBuilding: @staticmethod def where_clause_for(*args, **kwargs): @@ -401,11 +400,11 @@ def test_with_legacy_keyword(self): '(ivoid IN (SELECT ivoid FROM rr.resource WHERE ' "1=ivo_hasword(res_description, 'plain') UNION SELECT ivoid FROM rr.resource " "WHERE 1=ivo_hasword(res_title, 'plain') UNION SELECT ivoid FROM " - "rr.res_subject WHERE res_subject ILIKE '%plain%'))\n" + "rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%plain%'))\n" ' AND (ivoid IN (SELECT ivoid FROM rr.resource WHERE ' "1=ivo_hasword(res_description, 'string') UNION SELECT ivoid FROM rr.resource " "WHERE 1=ivo_hasword(res_title, 'string') UNION SELECT ivoid FROM " - "rr.res_subject WHERE res_subject ILIKE '%string%'))") + "rr.res_subject WHERE rr.res_subject.res_subject ILIKE '%string%'))") class TestSelectClause: