3333
3434 # Schema show
3535 df = DataFrame (x= [1.0 ,2.0 ,3.0 ], y= [" a" ," b" ," c" ])
36- s = schema (df)
37- io = IOBuffer ()
38- show (io, MIME (" text/plain" ), ScientificTypes. schema (df))
39- @test String (take! (io)) == " ┌───────┬────────────┬─────────┐\n │ names │ scitypes │ types │\n ├───────┼────────────┼─────────┤\n │ x │ Continuous │ Float64 │\n │ y │ Textual │ String │\n └───────┴────────────┴─────────┘\n "
36+ s = ScientificTypes. schema (df)
37+ str = sprint (show, MIME (" text/plain" ), s)
38+ @test str == " ┌───────┬────────────┬─────────┐\n " *
39+ " │ names │ scitypes │ types │\n " *
40+ " ├───────┼────────────┼─────────┤\n " *
41+ " │ x │ Continuous │ Float64 │\n " *
42+ " │ y │ Textual │ String │\n " *
43+ " └───────┴────────────┴─────────┘\n "
4044end
4145
4246struct MySchemalessTable{U, V}
4347 x:: Vector{U}
4448 y:: Vector{V}
4549end
46-
50+
4751Tables. istable (:: MySchemalessTable ) = true
4852Tables. columnaccess (:: Type{<:MySchemalessTable} ) = true
4953Tables. columns (t:: MySchemalessTable ) = t
@@ -63,7 +67,7 @@ struct ExtremelyWideTable{U, V}
6367 a:: Vector{U}
6468 b:: Vector{V}
6569end
66-
70+
6771Tables. istable (:: ExtremelyWideTable ) = true
6872Tables. columnaccess (:: Type{<:ExtremelyWideTable} ) = true
6973Tables. columns (t:: ExtremelyWideTable ) = t
@@ -105,13 +109,13 @@ end
105109
106110 # schema of non-tabular objects
107111 @test_throws ArgumentError schema ([:x , :y ])
108-
112+
109113 # PR #61 "schema check for `Tables.DictColumn`"
110114 X1 = Dict (:a => rand (5 ), :b => rand (Int, 5 ))
111115 s1 = schema (X1)
112116 @test s1. scitypes == (Continuous, Count)
113117 @test s1. types == (Float64, Int64)
114-
118+
115119 # issue 47 (schema for objects, `X` with, `Tables.schema(X) == nothing`)
116120 X2 = MySchemalessTable (rand (3 ), rand (Int, 3 ))
117121 s2 = schema (X2)
132136 @test ST. _rows_schema (
133137 Tables. rows (X3), Tables. schema (X3)
134138 ) == ST. Schema (Tables. columnnames (X3), (Continuous, Count), (Float64, Int))
135-
136- # test schema for column oreinted tables with number of columns
139+
140+ # test schema for column oreinted tables with number of columns
137141 # exceeding COLS_SPECIALIZATION_THRESHOLD.
138142 nt = NamedTuple{
139143 Tuple (Symbol (" x$i " ) for i in Base. OneTo (ST. COLS_SPECIALIZATION_THRESHOLD + 1 ))
154158 Tables. columnnames (nt),
155159 NTuple{ST. COLS_SPECIALIZATION_THRESHOLD + 1 , Continuous},
156160 NTuple{ST. COLS_SPECIALIZATION_THRESHOLD + 1 , Float64}
157- )
161+ )
158162
159163 end
160-
0 commit comments