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

Different length of evaluated output in REPL and during doctests. #1219

Closed
aborzunov opened this issue Dec 21, 2019 · 2 comments
Closed

Different length of evaluated output in REPL and during doctests. #1219

aborzunov opened this issue Dec 21, 2019 · 2 comments

Comments

@aborzunov
Copy link

aborzunov commented Dec 21, 2019

I have an example in my index.md that produces an error that originates from the fact, that during doctests evaluated output is being shortened, but not in REPL.

```jldoctest demo
julia> y = u_init.( Xₙ[n] for n in 2:N )
39-element Array{Float64,1}:
 -8.010340876819335
 -8.017828522120382
 -8.006733491677299
 -7.958156688432881
 -7.833646561079693
 -7.5583895218691985
 -7.000181421210685
 -5.970893714323723
 -4.324519390104715
 -2.1875
 -0.049230609895282385
  1.6008937143237265
  2.636431421210687
  3.203389521869199
  3.489896561079693
  3.628156688432881
  3.6929834916772997
  3.7228285221203827
  3.7365908768193337
  3.7433666563569172
  3.747490716170851
  3.7510192650881646
  3.754925504812066
  3.759669571706625
  3.7654689144584026
  3.7724262699047735
  3.780590172256178
  3.7899835485135176
  3.8006172288624214
  3.8124963291732765
  3.8256232660239555
  3.8399991809276504
  3.8556246130976035
  3.872499817240246
  3.890624913670404
  3.9099999592207864
  3.930624980737263
  3.9524999909009275
  3.975624995701903

When i build docs i have the error:

┌ Error: doctest failure in src/index.md:62-104
│
│ ```jldoctest demo
│ julia> y = u_init.( Xₙ[n] for n in 2:N )
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│  -0.049230609895282385
│   1.6008937143237265
│   2.636431421210687
│   3.203389521869199
│   3.489896561079693
│   3.628156688432881
│   3.6929834916772997
│   3.7228285221203827
│   3.7365908768193337
│   3.7433666563569172
│   3.747490716170851
│   3.7510192650881646
│   3.754925504812066
│   3.759669571706625
│   3.7654689144584026
│   3.7724262699047735
│   3.780590172256178
│   3.7899835485135176
│   3.8006172288624214
│   3.8124963291732765
│   3.8256232660239555
│   3.8399991809276504
│   3.8556246130976035
│   3.872499817240246
│   3.890624913670404
│   3.9099999592207864
│   3.930624980737263
│   3.9524999909009275
│   3.975624995701903
│ ```
│
│ Subexpression:
│
│ y = u_init.( Xₙ[n] for n in 2:N )
│
│ Evaluated output:
│
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│   ⋮
│   3.8256232660239555
│   3.8399991809276504
│   3.8556246130976035
│   3.872499817240246
│   3.890624913670404
│   3.9099999592207864
│   3.930624980737263
│   3.9524999909009275
│   3.975624995701903
│
│ Expected output:
│
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│  -0.049230609895282385
│   1.6008937143237265
│   2.636431421210687
│   3.203389521869199
│   3.489896561079693
│   3.628156688432881
│   3.6929834916772997
│   3.7228285221203827
│   3.7365908768193337
│   3.7433666563569172
│   3.747490716170851
│   3.7510192650881646
│   3.754925504812066
│   3.759669571706625
│   3.7654689144584026
│   3.7724262699047735
│   3.780590172256178
│   3.7899835485135176
│   3.8006172288624214
│   3.8124963291732765
│   3.8256232660239555
│   3.8399991809276504
│   3.8556246130976035
│   3.872499817240246
│   3.890624913670404
│   3.9099999592207864
│   3.930624980737263
│   3.9524999909009275
│   3.975624995701903
│
│   diff =
│    39-element Array{Float64,1}:
│     -8.010340876819335
│     -8.017828522120382
│     -8.006733491677299
│     -7.958156688432881
│     -7.833646561079693
│     -7.5583895218691985
│     -7.000181421210685
│     -5.970893714323723
│     -4.324519390104715
│     -2.1875
│     -0.049230609895282385
│      1.6008937143237265
│      2.636431421210687
│      3.203389521869199
│      3.489896561079693
│      3.628156688432881
│      3.6929834916772997
│      3.7228285221203827
│      3.7365908768193337
│      3.7433666563569172
│      3.747490716170851
│      3.7510192650881646
│      3.754925504812066
│      3.759669571706625
│      3.7654689144584026
│      3.7724262699047735
│      3.780590172256178
│      3.7899835485135176
│      3.8006172288624214
│      3.8124963291732765
│      -2.1875
│      ⋮
│      3.8256232660239555
│      3.8399991809276504
│      3.8556246130976035
│      3.872499817240246
│      3.890624913670404
│      3.9099999592207864
│      3.930624980737263
│      3.9524999909009275
│      3.975624995701903
└ @ Documenter.DocTests ~/.julia/packages/Documenter/BZNsm/src/DocTests.jl:364

Truncating with [...] also doesn't help.

Error: doctest failure in src/index.md:62-77
│
│ ```jldoctest demo
│ julia> y = u_init.( Xₙ[n] for n in 2:N )
│
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│  [...]
│ ```
│
│ Subexpression:
│
│ y = u_init.( Xₙ[n] for n in 2:N )
│
│ Evaluated output:
│
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│   ⋮
│   3.8256232660239555
│   3.8399991809276504
│   3.8556246130976035
│   3.872499817240246
│   3.890624913670404
│   3.9099999592207864
│   3.930624980737263
│   3.9524999909009275
│   3.975624995701903
│
│ Expected output:
│
│
│ 39-element Array{Float64,1}:
│  -8.010340876819335
│  -8.017828522120382
│  -8.006733491677299
│  -7.958156688432881
│  -7.833646561079693
│  -7.5583895218691985
│  -7.000181421210685
│  -5.970893714323723
│  -4.324519390104715
│  -2.1875
│  [...]
│
│   diff =
│
│    39-element Array{Float64,1}:
│     -8.010340876819335
│     -8.017828522120382
│     -8.006733491677299
│     -7.958156688432881
│     -7.833646561079693
│     -7.5583895218691985
│     -7.000181421210685
│     -5.970893714323723
│     -4.324519390104715
│     -2.1875
│     [...]-2.1875
│      ⋮
│      3.8256232660239555
│      3.8399991809276504
│      3.8556246130976035
│      3.872499817240246
│      3.890624913670404
│      3.9099999592207864
│      3.930624980737263
│      3.9524999909009275
│      3.975624995701903
└ @ Documenter.DocTests ~/.julia/packages/Documenter/BZNsm/src/DocTests.jl:364
@mortenpi
Copy link
Member

mortenpi commented Jan 5, 2020

I think in the REPL it depends on how large your REPL window is? When running doctests, we use some default value (not sure what exactly, but there is some default IOContext is presume?).

I'd say that this is related to #942, but I don't think there is a bug here. I'd suggest you just use the string Documenter produces (see Fixing Outdate Doctests to automatically fix all your doctests).

@aborzunov
Copy link
Author

I found that changing my terminal size affects output length and height, so even if i could control width and height like #942 proposes, i don't know what value i should use.

So this is kind of duplicate #942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants