# Printing types: regular usage vs. jldoctests

**URL:** <https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892>\
**Category:** General Usage\
**Created:** [November 21, 2024, 12:00pm UTC](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892 "2024-11-21T12:00:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 21, 2024, 12:00pm UTC](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892/1 "2024-11-21T12:00:25Z")

</div>

When I use my package regularly, a data type is shown like this:

```julia-repl
julia> using PDBTools

julia> ats = read_pdb(PDBTools.TESTPDB)
   Vector{Atom{Nothing}} with 62026 atoms with fields:
   index name resname chain resnum residue x y z occup beta model segname index_pdb
       1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 0.00 1 PROT 1

```

where we see `Vector{Atom{Nothing}}` as the type of the array.

Now, I have `jldoctest` which is identical to the above, but the test fails because it expects `Vector{PDBTools.Atom{Nothing}}` instead:

```julia
│ diff =
│ Vector{Atom{Nothing}} Vector{PDBTools.Atom{Nothing}} with 72 atoms with fields:
│ index name resname chain resnum residue x y z occup beta model segname index_pdb
│ 1 N ALA A 1 1 -9.229 -14.861 -5.481 0.00 0.00 1 PROT 1

```

Why is the type printed differently in the `jlsdoctest` vs. regular usage of the package, and how that can be solved?

Thanks.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 21, 2024, 12:40pm UTC](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892/2 "2024-11-21T12:40:09Z")

</div>

Additional info: This incongruity happens on the CI run, but not when I run `doctests` locally. I can even run `doctests(PDBTools; fix=true)` and all works locally, but these tests fail on the CI execution.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 21, 2024, 4:24pm UTC](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892/3 "2024-11-21T16:24:39Z")

</div>

edit: The issue is when running this as part of the test suite of the package:

```julia
@testitem "Doctests" begin
    using Documenter: doctest
    using PDBTools # with or without this
    doctest(PDBTools)
end

```

Thus, I’ll just remove that from the test suite. But I wonder which is the scoping issue that’s causing the types to be printed differently in each case.
