Skip to content

Commit

Permalink
replace printtable test (#29)
Browse files Browse the repository at this point in the history
* don't bundle with my other PR

* use sprint to test output

* try and account for different line endings when hashing

* fix tests

* hashing
  • Loading branch information
cjprybol authored and nalimilan committed Jul 8, 2017
1 parent d30a94c commit c753ac7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/abstractdataframe/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function printtable(io::IO,
quotestr = string(quotemark)
for i in 1:n
for j in 1:p
if !isnull(df[j],i)
if !isnull(df[j][i])
if ! (etypes[j] <: Real)
print(io, quotemark)
escapedprint(io, get(df[i, j]), quotestr)
Expand Down
12 changes: 12 additions & 0 deletions test/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module TestIO
using Base.Test
using DataFrames
using LaTeXStrings
using NullableArrays
using CategoricalArrays

# Test LaTeX export
df = DataFrame(A = 1:4,
Expand Down Expand Up @@ -38,4 +40,14 @@ module TestIO
show(io, "text/html", df)
@test length(String(take!(io))) < 10000

df = DataFrame(A = 1:26,
B = 'a':'z',
C = [string(x) for x='A':'Z'],
D = CategoricalArray([string(x) for x='A':'Z']),
E = NullableArray(rand(26)),
F = NullableArray(fill(Nullable(), 26)),
G = fill(Nullable(), 26))

answer = Sys.WORD_SIZE == 64 ? 0xde54e70f51205910 : 0x340524cd
@test hash(sprint(printtable, df)) == answer
end

0 comments on commit c753ac7

Please sign in to comment.