Skip to content
New issue

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

Fix doctest code-blocks in documentation #15753

Closed
wants to merge 8 commits into from
Closed

Fix doctest code-blocks in documentation #15753

wants to merge 8 commits into from

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Apr 3, 2016

Due to backtrace and printing changes most of the doctests are currently failing.

Remaining issues are:

Changed syntax errors

File "manual/variables.rst", line 131, in default
Failed example:
    try = "No"
Expected:
    ERROR: syntax: unexpected "="
Got:
    ERROR: syntax: unhandled expr (error #<julia: "unexpected "="">)
     in eval(::Module, ::Any) at ./boot.jl:237

Method overwritten

File "manual/stacktraces.rst", line 173, in default
Failed example:
    @noinline parent() = child()
Expected:
    parent (generic function with 1 method)
Got:
    WARNING: Method definition parent() in module Main at none:1 overwritten at none:1.
    parent (generic function with 1 method)

Changed Unit-range printing

File "manual/arrays.rst", line 312, in default
Failed example:
    searchsorted(a, 3)
Expected:
    3:2
Got:
    0-element UnitRange{Int64}

Inf in Tuple printing

Failed example:
    (typemin(Float16),typemax(Float16))
Expected:
    (-Inf16,Inf16)
Got:
    (-Inf,Inf)

Todo

  • Decide if unitrange is a regression (if not reformulate example)
  • Are syntax error a regression? (They seem to be less readable than before.)
  • Enable doctests on travis
  • Fix doctests in stdlib
  • Fix doctests in devdocs
  • What to do with method overwritten errors (They are clutter and don't add to the examples, on the other hand renaming the methods is excessive)

@vchuravy vchuravy changed the title fixup doctest code-blocks in generator documentation Fix doctest code-blocks in documentation Apr 3, 2016
@yuyichao
Copy link
Contributor

yuyichao commented Apr 3, 2016

Ref #13966

@yuyichao
Copy link
Contributor

yuyichao commented Apr 3, 2016

What to do with method overwritten errors

I think we can just rename the method....

@vchuravy
Copy link
Member Author

vchuravy commented Apr 4, 2016

@nalimilan, was this intended to be a doctest?

File "manual/documentation.rst", line 42, in default
Failed example:
    bar([1, 2], [1, 2])
Expected:
    1
    ```
    """
    function bar(x, y) ...
Got:
    ERROR: UndefVarError: bar not defined
     in eval(::Module, ::Any) at ./boot.jl:237

Otherwise we are down to 40 failures all in the style described above. And where I am not quite certain how to proceed.

@vchuravy
Copy link
Member Author

vchuravy commented Apr 4, 2016

I renamed the problematic functions, but I am open to better suggestions.

Doctest summary
===============
 1056 tests
    7 failures in tests
    0 failures in setup code
    0 failures in cleanup code

@vchuravy
Copy link
Member Author

vchuravy commented Apr 7, 2016

I think we can merge this and I will open issues about the remaining failing tests.

@nalimilan
Copy link
Member

That bar code block wasn't supposed to be a doctest. I think I kept how things were before without thinking too much about it.

@vchuravy
Copy link
Member Author

vchuravy commented Apr 8, 2016

Thanks fixed.

@vchuravy
Copy link
Member Author

vchuravy commented Apr 9, 2016

All done. All tests are now passing

Doctest summary
===============
 1058 tests
    0 failures in tests
    0 failures in setup code
    0 failures in cleanup code
build succeeded.

@@ -194,7 +194,7 @@ One can construct :obj:`TypeVar`\s manually:
.. doctest::

julia> TypeVar(:V, Signed, Real, false)
Signed<:V<:Real
V<:Real
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fff2b9a should the in_env be false if the :tvar_env context is not found?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who should we be asking that question?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkelman
Copy link
Contributor

tkelman commented May 5, 2016

Bump - this was great work, but goes stale quickly. Can you rebase and see where we stand?

@yuyichao yuyichao mentioned this pull request May 8, 2016
@vchuravy
Copy link
Member Author

I won't have time for a rebase till next week, but I will take a look after that.

@omus
Copy link
Member

omus commented Jun 23, 2016

@vchuravy could you use assistance with this PR? I was hoping to add a new doctest.

vchuravy and others added 3 commits June 24, 2016 03:37
Due to the changes in 4706184 tuples are now printed compact. Thus to
demonstrate the point in this example we have to execute the examples
independently.
@vchuravy
Copy link
Member Author

@omus I just rebased, but there is an problem with Array printing that causes doctest to fail. I don't have time to look into it right now so feel free to give it a go.

@@ -5643,7 +5643,8 @@ julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5)

julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2))
ERROR: ArgumentError: indices must be unique and sorted
in deleteat! at array.jl:543
in deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:565
in eval(::Module, ::Any) at ./boot.jl:237
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the doctest system should be pruning this line

@omus
Copy link
Member

omus commented Jun 24, 2016

I'm currently working on fixing doctests. Expect a PR before the end of JuliaCon

omus pushed a commit to omus/julia that referenced this pull request Jun 25, 2016
cb8aa0b - fix most doctests in the manual that changed due to backtraces.
cd3797e - fix stdlib doctests
1892f72 - fix doctests in devdocs
d9495c7 - resolve Warning mismatch by renaming functions
83ef854 - convert superflous doctest to code-block
78f6d70 - Fix example about typemax and typemin

          Due to the changes in 4706184 tuples are now printed compact. Thus to
          demonstrate the point in this example we have to execute the examples
          independently.
c03e6e0 - fixup linenumbers
35a31bb - start->first

Ref JuliaLang#15753
@omus omus mentioned this pull request Jun 25, 2016
@tkelman
Copy link
Contributor

tkelman commented Jun 25, 2016

I'm going to close this in favor of #17106 then, thanks to both @vchuravy and @omus

@tkelman tkelman closed this Jun 25, 2016
omus pushed a commit to omus/julia that referenced this pull request Jul 7, 2016
cb8aa0b - fix most doctests in the manual that changed due to backtraces.
cd3797e - fix stdlib doctests
1892f72 - fix doctests in devdocs
d9495c7 - resolve Warning mismatch by renaming functions
83ef854 - convert superflous doctest to code-block
78f6d70 - Fix example about typemax and typemin

          Due to the changes in 4706184 tuples are now printed compact. Thus to
          demonstrate the point in this example we have to execute the examples
          independently.
c03e6e0 - fixup linenumbers
35a31bb - start->first

Ref JuliaLang#15753
omus pushed a commit to omus/julia that referenced this pull request Jul 8, 2016
cb8aa0b - fix most doctests in the manual that changed due to backtraces.
cd3797e - fix stdlib doctests
1892f72 - fix doctests in devdocs
d9495c7 - resolve Warning mismatch by renaming functions
83ef854 - convert superflous doctest to code-block
78f6d70 - Fix example about typemax and typemin

          Due to the changes in 4706184 tuples are now printed compact. Thus to
          demonstrate the point in this example we have to execute the examples
          independently.
c03e6e0 - fixup linenumbers
35a31bb - start->first

Ref JuliaLang#15753
omus pushed a commit to omus/julia that referenced this pull request Jul 11, 2016
cb8aa0b - fix most doctests in the manual that changed due to backtraces.
cd3797e - fix stdlib doctests
1892f72 - fix doctests in devdocs
d9495c7 - resolve Warning mismatch by renaming functions
83ef854 - convert superflous doctest to code-block
78f6d70 - Fix example about typemax and typemin

          Due to the changes in 4706184 tuples are now printed compact. Thus to
          demonstrate the point in this example we have to execute the examples
          independently.
c03e6e0 - fixup linenumbers
35a31bb - start->first

Ref JuliaLang#15753
mfasi pushed a commit to mfasi/julia that referenced this pull request Sep 5, 2016
cb8aa0b - fix most doctests in the manual that changed due to backtraces.
cd3797e - fix stdlib doctests
1892f72 - fix doctests in devdocs
d9495c7 - resolve Warning mismatch by renaming functions
83ef854 - convert superflous doctest to code-block
78f6d70 - Fix example about typemax and typemin

          Due to the changes in 4706184 tuples are now printed compact. Thus to
          demonstrate the point in this example we have to execute the examples
          independently.
c03e6e0 - fixup linenumbers
35a31bb - start->first

Ref JuliaLang#15753
@vchuravy vchuravy deleted the vc/fixup_docs branch October 28, 2016 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants