Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
slightly improve doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Dec 18, 2021
1 parent 6a56bb5 commit ae80b6d
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/sage/rings/continued_fraction_gosper.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def __iter__(self):
TESTS::
sage: a = Integer(randint(-100,100)); b = Integer(randint(-100,100));
sage: c = Integer(randint(-100,100)); d = Integer(randint(-100,100));
sage: from sage.rings.continued_fraction_gosper import gosper_iterator
sage: ig = iter(gosper_iterator(a,b,c,d,continued_fraction(pi))); icf = iter(continued_fraction((a*pi+b)/(c*pi+d)));
sage: a, b, c, d = (Integer(randint(-100,100)) for _ in range(4))
sage: ig = iter(gosper_iterator(a, b, c, d, continued_fraction(pi)))
sage: icf = iter(continued_fraction((a*pi + b) / (c*pi + d)));
sage: for i in range(10):
....: try:
....: assert next(ig) == next(icf)
....: except StopIteration:
....: pass
....: break
"""
return self

Expand All @@ -120,15 +120,10 @@ def __next__(self):
TESTS::
sage: a = Integer(randint(-100,100)); b = Integer(randint(-100,100));
sage: c = Integer(randint(-100,100)); d = Integer(randint(-100,100));
sage: from sage.rings.continued_fraction_gosper import gosper_iterator
sage: ig = iter(gosper_iterator(a,b,c,d,continued_fraction(pi))); icf = iter(continued_fraction((a*pi+b)/(c*pi+d)));
sage: for i in range(10):
....: try:
....: assert next(ig) == next(icf)
....: except StopIteration:
....: pass
sage: it = gosper_iterator(1, 0, 0, 1, continued_fraction(pi))
sage: list(next(it) for _ in range(10))
[3, 7, 15, 1, 292, 1, 1, 1, 2, 1]
"""
while True:
if self.currently_read >= self.input_preperiod_length:
Expand Down

0 comments on commit ae80b6d

Please sign in to comment.