Skip to content

Commit eee1416

Browse files
author
Release Manager
committed
gh-36976: Fix doctests in `src/sage/databases/oeis.py` Fixes #36966. <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36976 Reported by: David Coudert Reviewer(s): David Coudert, Martin Rubey
2 parents 9e160d3 + b798d69 commit eee1416

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/sage/databases/oeis.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _fetch(url):
177177
178178
TESTS::
179179
180-
sage: from sage.databases.oeis import _fetch, oeis_url
180+
sage: from sage.databases.oeis import _fetch, oeis_url # optional -- internet
181181
sage: _fetch(oeis_url + 'hints.html')[-8:-1] # optional -- internet
182182
'</html>'
183183
"""
@@ -309,12 +309,12 @@ class OEIS:
309309
14930352, 24157817, 39088169, 63245986, 102334155)
310310
311311
sage: fibo.cross_references()[0] # optional -- internet
312-
'A039834'
312+
'A001622'
313313
314314
sage: fibo == oeis(45) # optional -- internet
315315
True
316316
317-
sage: sfibo = oeis('A039834')
317+
sage: sfibo = oeis('A039834') # optional -- internet
318318
sage: sfibo.first_terms() # optional -- internet
319319
(1, 1, 0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55, 89, -144, 233,
320320
-377, 610, -987, 1597, -2584, 4181, -6765, 10946, -17711, 28657,
@@ -707,11 +707,12 @@ def online_update(self):
707707
708708
TESTS::
709709
710+
sage: # optional -- internet
710711
sage: s = oeis._imaginary_sequence(ident='A004238')
711712
sage: s
712713
A004238: The characteristic sequence of 42 plus one, starting from 38.
713-
sage: s.online_update() # optional -- internet
714-
sage: s # optional -- internet
714+
sage: s.online_update()
715+
sage: s
715716
A004238: a(n) = 100*log(n) rounded to nearest integer.
716717
"""
717718
options = {'q': self._id, 'n': '1', 'fmt': 'text'}
@@ -832,7 +833,7 @@ def raw_entry(self):
832833
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
833834
834835
sage: print(f.raw_entry()) # optional -- internet
835-
%I A000045 M0692 N0256
836+
%I A000045 M0692 N0256...
836837
%S A000045 0,1,1,2,3,5,8,13,21,34,55,89,144,...
837838
%T A000045 10946,17711,28657,46368,...
838839
...
@@ -898,7 +899,12 @@ def old_IDs(self):
898899
sage: s.old_IDs()
899900
('M9999', 'N9999')
900901
"""
901-
return tuple(self._field('I')[0].split(' '))
902+
s = self._field('I')[0]
903+
# We remove all parts after '#'
904+
s = s.split('#')[0].strip()
905+
if not s:
906+
return ()
907+
return tuple(s.split(' '))
902908

903909
def offsets(self):
904910
r"""
@@ -1042,11 +1048,11 @@ def natural_object(self):
10421048
10431049
::
10441050
1045-
sage: av = oeis('A087778'); av # optional -- internet
1046-
A087778: Decimal expansion ... Avogadro...
1051+
sage: av = oeis('A322578'); av # optional -- internet
1052+
A322578: Decimal expansion ... Avogadro...
10471053
10481054
sage: av.natural_object() # optional -- internet
1049-
6.022141000000000?e23
1055+
6.022140760000000?e23
10501056
10511057
::
10521058
@@ -1111,7 +1117,7 @@ def is_dead(self, warn_only=False):
11111117
A warning is triggered if any field of a dead sequence is accessed,
11121118
unless :meth:`is_dead` is called before::
11131119
1114-
sage: s = oeis(17)
1120+
sage: s = oeis(17) # optional -- internet
11151121
sage: s # optional -- internet
11161122
doctest:warning
11171123
...

0 commit comments

Comments
 (0)