| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -10,6 +10,7 @@ | |
| **Source code:** :source:`Lib/turtle.py` | ||
|
|
||
| .. testsetup:: default | ||
| :skipif: _tkinter is None | ||
|
|
||
| from turtle import * | ||
| turtle = Turtle() | ||
| Expand Down Expand Up | @@ -471,6 +472,7 @@ Turtle motion | |
| turtle is headed. Do not change the turtle's heading. | ||
|
|
||
| .. doctest:: | ||
| :skipif: _tkinter is None | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySince elsewhere the directly seems to apply to multiple test without intervening text (correct?), I believe addition makes the directive on 380-1 obsolete.
Sorry, something went wrong.
All reactions
|
||
| :hide: | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityDoes doctest really fail on blank output? Or what does :hide: do?
Sorry, something went wrong.
All reactions
|
||
|
|
||
| >>> turtle.goto(0, 0) | ||
| Expand Down Expand Up | @@ -809,6 +811,7 @@ Turtle motion | |
| last *n* stamps. | ||
|
|
||
| .. doctest:: | ||
| :skipif: _tkinter is None | ||
|
|
||
| >>> for i in range(8): | ||
| ... unused_stamp_id = turtle.stamp() | ||
| Expand Down Expand Up | @@ -1336,8 +1339,11 @@ More drawing control | |
| font. If *move* is true, the pen is moved to the bottom-right corner of the | ||
| text. By default, *move* is ``False``. | ||
|
|
||
| >>> turtle.write("Home = ", True, align="center") | ||
| >>> turtle.write((0,0), True) | ||
| .. doctest:: | ||
| :skipif: _tkinter is None | ||
|
|
||
| >>> turtle.write("Home = ", True, align="center") | ||
| >>> turtle.write((0,0), True) | ||
|
|
||
|
|
||
| Turtle state | ||
| Expand Down Expand Up | @@ -1374,12 +1380,15 @@ Visibility | |
|
|
||
| Return ``True`` if the Turtle is shown, ``False`` if it's hidden. | ||
|
|
||
| >>> turtle.hideturtle() | ||
| >>> turtle.isvisible() | ||
| False | ||
| >>> turtle.showturtle() | ||
| >>> turtle.isvisible() | ||
| True | ||
| .. doctest:: | ||
| :skipif: _tkinter is None | ||
|
|
||
| >>> turtle.hideturtle() | ||
| >>> turtle.isvisible() | ||
| False | ||
| >>> turtle.showturtle() | ||
| >>> turtle.isvisible() | ||
| True | ||
|
|
||
|
|
||
| Appearance | ||
| Expand Down Expand Up | @@ -1822,7 +1831,10 @@ Window control | |
| Set background image or return name of current backgroundimage. If *picname* | ||
| is a filename, set the corresponding image as background. If *picname* is | ||
| ``"nopic"``, delete background image, if present. If *picname* is ``None``, | ||
| return the filename of the current backgroundimage. :: | ||
| return the filename of the current backgroundimage. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMaybe we should just not add the .. doctest directive here, if we never want sphinx to actually run this REPL snippet as a doctest?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIf I remove this line, there will be an error locally. I don't know why, I have no idea how to debug this kind of problems.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityOh. That's weird :(
Sorry, something went wrong.
All reactions
|
||
|
|
||
| >>> screen.bgpic() | ||
| 'nopic' | ||
| Expand Down Expand Up | @@ -1873,6 +1885,9 @@ Window control | |
| method, one can make visible those parts of a drawing which were outside the | ||
| canvas before. | ||
|
|
||
| .. doctest:: | ||
| :skipif: _tkinter is None | ||
|
|
||
| >>> screen.screensize() | ||
| (400, 300) | ||
| >>> screen.screensize(2000,1500) | ||
| Expand Down Expand Up | @@ -2089,7 +2104,10 @@ Input methods | |
| Pop up a dialog window for input of a string. Parameter title is | ||
| the title of the dialog window, prompt is a text mostly describing | ||
| what information to input. | ||
| Return the string input. If the dialog is canceled, return ``None``. :: | ||
| Return the string input. If the dialog is canceled, return ``None``. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> screen.textinput("NIM", "Name of first player:") | ||
|
|
||
| Expand All | @@ -2109,7 +2127,10 @@ Input methods | |
| The number input must be in the range minval .. maxval if these are | ||
| given. If not, a hint is issued and the dialog remains open for | ||
| correction. | ||
| Return the number input. If the dialog is canceled, return ``None``. :: | ||
| Return the number input. If the dialog is canceled, return ``None``. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> screen.numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000) | ||
|
|
||
| Expand Down Expand Up | @@ -2197,9 +2218,12 @@ Settings and special methods | |
| There are three different ways to call this function: | ||
|
|
||
| (1) *name* is the name of a gif-file and *shape* is ``None``: Install the | ||
| corresponding image shape. :: | ||
| corresponding image shape. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> screen.register_shape("turtle.gif") | ||
| >>> screen.register_shape("turtle.gif") | ||
|
|
||
| .. note:: | ||
| Image shapes *do not* rotate when turning the turtle, so they do not | ||
| Expand Down Expand Up | @@ -2233,15 +2257,21 @@ Settings and special methods | |
|
|
||
| .. function:: window_height() | ||
|
|
||
| Return the height of the turtle window. :: | ||
| Return the height of the turtle window. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> screen.window_height() | ||
| 480 | ||
|
|
||
|
|
||
| .. function:: window_width() | ||
|
|
||
| Return the width of the turtle window. :: | ||
| Return the width of the turtle window. | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> screen.window_width() | ||
| 640 | ||
| Expand Down Expand Up | @@ -2448,7 +2478,10 @@ facilities: | |
| - When using IDLE, tooltips show the signatures and first lines of the | ||
| docstrings of typed in function-/method calls. | ||
|
|
||
| - Calling :func:`help` on methods or functions displays the docstrings:: | ||
| - Calling :func:`help` on methods or functions displays the docstrings: | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> help(Screen.bgcolor) | ||
| Help on method bgcolor in module turtle: | ||
| Expand Down Expand Up | @@ -2480,7 +2513,10 @@ facilities: | |
| >>> turtle.penup() | ||
|
|
||
| - The docstrings of the functions which are derived from methods have a modified | ||
| form:: | ||
| form: | ||
|
|
||
| .. doctest:: | ||
| :skipif: True | ||
|
|
||
| >>> help(bgcolor) | ||
| Help on function bgcolor in module turtle: | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySince the directive is only 'seen' by sphinx, doctest.testfile fails miserably on this file (326 of 337). It seems that this file was never meant to be doctested. Can one make the directive global instead of local.
If the 2 lines were given as examples of how to minimally start (>>> import, >>> turtle =) as would seem sensible, then I believe tests would run. But I understand that you are not intending to edit content.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.