Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: author constraint missed rr.res_role extra table #515

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Enhancements and Fixes
----------------------

- Fix ``pyvo.registry.Author`` to allow registry searches with author constraints. [#515]

- Add method ``list_services`` to ``pyvo.registry.regtap.RegistryResource`` that returns the
list of available services. Add ``keyword`` parameter in ``get_service`` which should match
``capability_description``. [#505]
Expand Down
1 change: 1 addition & 0 deletions pyvo/registry/rtcons.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def __init__(self, name: str):
"""
self._condition = "role_name LIKE {auth} AND base_role='creator'"
self._fillers = {"auth": name}
self._extra_tables = ["rr.res_role"]


class Servicetype(Constraint):
Expand Down
38 changes: 38 additions & 0 deletions pyvo/registry/tests/test_rtcons.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,41 @@ def test_group_by_columns(self):
"region_of_regard, "
"waveband, "
"alt_identifier"))

def test_joined_tables(self):
expected_tables = [
# from author constraint
"rr.res_role",
# default tables
"rr.resource",
"rr.capability",
"rr.interface",
"rr.alt_identifier"
]
assert all(table in _build_regtap_query_with_fake([rtcons.Author("%Hubble%")])
for table in expected_tables)


@pytest.mark.remote_data
def test_all_constraints():
text = rtcons.Freetext("star")
author = rtcons.Author(r"%ESA%")
servicetype = rtcons.Servicetype("tap")
waveband = rtcons.Waveband("optical")
datamodel = rtcons.Datamodel("obscore")
ivoid = rtcons.Ivoid(r"ivoid")
ucd = rtcons.UCD(r"pos.eq.ra")
moc = rtcons.Spatial("0/0-11", intersect="overlaps")
spectral = rtcons.Spectral((5000 * u.Angstrom, 6000 * u.Angstrom))
time = rtcons.Temporal((50000, 60000))
result = registry.search(
text, author, servicetype, waveband, datamodel,
ivoid, ucd, moc, spectral, time
)
assert result.fieldnames == (
'ivoid', 'res_type', 'short_name',
'res_title', 'content_level', 'res_description',
'reference_url', 'creator_seq', 'created', 'updated',
'rights', 'content_type', 'source_format', 'source_value',
'region_of_regard', 'waveband', 'access_urls', 'standard_ids',
'intf_types', 'intf_roles', 'cap_descriptions', 'alt_identifier')
Loading