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 doctests #464

Merged
merged 1 commit into from
Jul 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"

[compat]
Documenter = "0.24"
Documenter = "0.27"
Latexify = "0.13"
10 changes: 5 additions & 5 deletions docs/src/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ the following three cases:

```jldoctest
julia> [1.0u"m", 2.0u"m"]
2-element Array{Quantity{Float64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}},1}:
2-element Vector{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}:
1.0 m
2.0 m

julia> [1.0u"m", 2.0u"cm"]
2-element Array{Quantity{Float64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}},1}:
2-element Vector{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}:
1.0 m
0.02 m

julia> [1.0u"m", 2.0]
2-element Array{Quantity{Float64,D,U} where U where D,1}:
2-element Vector{Quantity{Float64, D, U} where {D, U}}:
1.0 m
2.0
```
Expand All @@ -166,7 +166,7 @@ julia> f([1.0u"m", 2.0u"cm"])
1.02 m

julia> f([1.0u"g", 2.0u"cm"])
ERROR: MethodError: no method matching f(::Array{Quantity{Float64,D,U} where U where D,1})
ERROR: MethodError: no method matching f(::Vector{Quantity{Float64, D, U} where {D, U}})
[...]
```

Expand Down Expand Up @@ -304,6 +304,6 @@ quantity to the [`NoUnits`](@ref) constructor. This takes into account different
```jldoctest
julia> using Unitful

julia> julia> 1u"kN*m"/4u"J" |> NoUnits
julia> 1u"kN*m"/4u"J" |> NoUnits
250.0
```
9 changes: 3 additions & 6 deletions docs/src/highlights.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,9 @@ in toy calculations for
where some conventions yield matrices with mixed dimensions:

```jldoctest
julia> Diagonal([-1.0u"c^2", 1.0, 1.0, 1.0])
4×4 Diagonal{Unitful.Quantity{Float64,D,U}}:
-1.0 c^2 ⋅ ⋅ ⋅
⋅ 1.0 ⋅ ⋅
⋅ ⋅ 1.0 ⋅
⋅ ⋅ ⋅ 1.0
julia> using LinearAlgebra

julia> Diagonal([-1.0u"c^2", 1.0, 1.0, 1.0]);
```

## Logarithmic units
Expand Down
2 changes: 1 addition & 1 deletion docs/src/newunits.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MyUnits
julia> using Unitful

julia> u"myMeter"
ERROR: LoadError: ArgumentError: Symbol myMeter could not be found in unit modules Module[Unitful]
ERROR: LoadError:
[...]

julia> Unitful.register(MyUnits);
Expand Down
2 changes: 1 addition & 1 deletion src/user.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ julia> u"m,kg,s"
(m, kg, s)

julia> typeof(1.0u"m/s")
Quantity{Float64,𝐋 𝐓^-1,Unitful.FreeUnits{(m, s^-1),𝐋 𝐓^-1,nothing}}
Quantity{Float64, 𝐋 𝐓^-1, Unitful.FreeUnits{(m, s^-1), 𝐋 𝐓^-1, nothing}}

julia> u"ħ"
1.0545718176461565e-34 J s
Expand Down
10 changes: 5 additions & 5 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ the result to PyPlot, for example.

```jldoctest
julia> a = [1u"m", 2u"m"]
2-element Array{Quantity{Int64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}},1}:
2-element Vector{Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}:
1 m
2 m

julia> b = ustrip(a)
2-element reinterpret(Int64, ::Array{Quantity{Int64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}},1}):
2-element reinterpret(Int64, ::Vector{Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}):
1
2

julia> a[1] = 3u"m"; b
2-element reinterpret(Int64, ::Array{Quantity{Int64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}},1}):
2-element reinterpret(Int64, ::Vector{Quantity{Int64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}):
3
2
```
Expand Down Expand Up @@ -120,10 +120,10 @@ Examples:

```jldoctest
julia> typeof(unit(1.0))
Unitful.FreeUnits{(),NoDims,nothing}
Unitful.FreeUnits{(), NoDims, nothing}

julia> typeof(unit(Float64))
Unitful.FreeUnits{(),NoDims,nothing}
Unitful.FreeUnits{(), NoDims, nothing}

julia> unit(1.0) == NoUnits
true
Expand Down