Skip to content

Commit

Permalink
Merge pull request #14702 from pllim/votable-print-clearer
Browse files Browse the repository at this point in the history
repr for VOTable is now clearer
  • Loading branch information
pllim committed Jun 2, 2023
2 parents e7c1b8b + 8da73c7 commit e62fd73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions astropy/io/votable/tests/vo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ def test_repr(self):
# Resource
assert repr(self.votable.resources) == "[</>]"

# Table
assert repr(self.table).startswith("<VOTable")


class TestThroughTableData(TestParse):
def setup_class(self):
Expand Down
5 changes: 4 additions & 1 deletion astropy/io/votable/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,10 @@ def __init__(
warn_unknown_attrs("TABLE", extra.keys(), config, pos)

def __repr__(self):
return repr(self.to_table())
s = repr(self.to_table())
if s.startswith("<Table"):
s = "<VO" + s[1:]
return s

def __bytes__(self):
return bytes(self.to_table())
Expand Down
1 change: 1 addition & 0 deletions docs/changes/io.votable/14702.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Output of ``repr`` for VOTable instance now clearly shows it is a VOTable and not generic astropy Table.

0 comments on commit e62fd73

Please sign in to comment.