Skip to content

Commit 0935a0b

Browse files
committed
fix doctest in gap_packages (using empty table)
1 parent 3dd953c commit 0935a0b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/sage/misc/table.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def _widths(self):
432432
widths = w
433433
return tuple(widths)
434434

435-
def _repr_(self):
435+
def _repr_(self) -> str:
436436
r"""
437437
String representation of a table.
438438
@@ -470,7 +470,8 @@ def _repr_(self):
470470

471471
for row in rows[:-1]:
472472
s += self._str_table_row(row, header_row=False)
473-
s += self._str_table_row(rows[-1], header_row=False, last_row=True)
473+
if rows:
474+
s += self._str_table_row(rows[-1], header_row=False, last_row=True)
474475
return s.strip("\n")
475476

476477
def _rich_repr_(self, display_manager, **kwds):

src/sage/tests/gap_packages.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sage: pkgs = all_installed_packages(ignore_dot_gap=True)
99
sage: test_packages(pkgs, only_failures=True) # optional - gap_packages
1010
Status Package GAP Output
11-
+--------+---------+------------+
11+
├────────┼─────────┼────────────┤
1212
1313
sage: test_packages(['primgrp', 'smallgrp'])
1414
Status Package GAP Output
@@ -51,13 +51,13 @@ def test_packages(packages, only_failures=False):
5151
5252
sage: pkgs = all_installed_packages()
5353
sage: test_packages(pkgs) # random output
54-
Status Package GAP Output
55-
+---------+------------+------------+
56-
Alnuth true
57-
GAPDoc true
58-
sonata true
59-
tomlib true
60-
toric true
54+
Status Package GAP Output
55+
├────────┼─────────┼────────────┤
56+
Alnuth true
57+
GAPDoc true
58+
sonata true
59+
tomlib true
60+
toric true
6161
"""
6262
rows = [['Status', 'Package', 'GAP Output']]
6363
for pkgdir in packages:

0 commit comments

Comments
 (0)