Skip to content

Commit b4eaf58

Browse files
committed
Fix spec files for daru 2.0
1 parent 6b49cd9 commit b4eaf58

File tree

4 files changed

+76
-57
lines changed

4 files changed

+76
-57
lines changed

spec/daru/io/importers/csv_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
it_behaves_like 'exact daru dataframe',
2525
ncols: 3,
2626
nrows: 99,
27-
order: %i[image_resolution mls true_transform],
27+
order: %i[image_resolution true_transform mls],
2828
:'image_resolution.first' => 6.55779,
2929
:'true_transform.first' => '-0.2362347,0.6308649,0.7390552,0,0.6523478'\
3030
',-0.4607318,0.6018043,0,0.7201635,0.6242881'\
@@ -91,7 +91,7 @@
9191
it_behaves_like 'exact daru dataframe',
9292
ncols: 8,
9393
nrows: 9,
94-
order: %i[account manager name price product quantity rep status]
94+
order: %i[account name rep manager product quantity price status]
9595
end
9696

9797
context 'skips rows from CSV files without headers option' do

spec/daru/io/importers/r_data_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
nrows: 1629,
1313
index: (0..1628).to_a,
1414
order: %i[
15-
Abbreviation FIPS Non.US State cnty females.divorced females.married ind-agric
16-
ind-arts ind-construc ind-educational ind-finance ind-information ind-manufact
17-
ind-other.industry ind-public.admin ind-retail ind-scientific ind-transport
18-
ind-wholesale males.diorced males.married median.earnings perc.HS+ perc.disability
19-
perc.no.health.insurance race-am.ind race-asian race-black race-white
15+
State Abbreviation FIPS
16+
males.married males.diorced females.married females.divorced
17+
perc.HS+ Non.US perc.disability
18+
race-white race-black race-am.ind race-asian
19+
ind-agric ind-construc ind-manufact ind-wholesale ind-retail ind-transport ind-information
20+
ind-finance ind-scientific ind-educational ind-arts ind-other.industry ind-public.admin
21+
median.earnings perc.no.health.insurance cnty
2022
]
2123
end
2224

@@ -29,7 +31,7 @@
2931
nrows: 1755,
3032
index: (0..1754).to_a,
3133
order: %i[
32-
Business.Filings Non.Business.Filings State.Code Total.Filings year
34+
State.Code Total.Filings Business.Filings Non.Business.Filings year
3335
]
3436
end
3537

@@ -42,7 +44,7 @@
4244
nrows: 1632,
4345
index: (0..1631).to_a,
4446
order: %i[
45-
Date State own.rate se
47+
State Date own.rate se
4648
]
4749
end
4850

spec/daru/io/importers/rds_spec.rb

Lines changed: 55 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
nrows: 1113,
1010
index: (0..1112).to_a,
1111
order: %i[
12-
area description epa_reach format_version latitude location location_code location_type
13-
longitude name psc_basin psc_region record_code record_origin region reporting_agency
14-
rmis_basin rmis_latitude rmis_longitude rmis_region sector state_or_province sub_location
15-
submission_date water_type
12+
state_or_province water_type sector region area location sub_location
13+
record_code format_version submission_date reporting_agency
14+
location_code location_type name latitude longitude psc_basin
15+
psc_region epa_reach description rmis_region rmis_basin rmis_latitude
16+
rmis_longitude record_origin
1617
]
1718
end
1819

@@ -24,7 +25,7 @@
2425
nrows: 6940,
2526
index: (0..6939).to_a,
2627
order: %i[
27-
city date dptp no2tmean2 o3tmean2 pm10tmean2 pm25tmean2 tmpd
28+
city tmpd dptp date pm25tmean2 pm10tmean2 o3tmean2 no2tmean2
2829
]
2930
end
3031

@@ -36,7 +37,7 @@
3637
nrows: 3030,
3738
index: (0..3029).to_a,
3839
order: %i[
39-
Country Health.Expenditure Life.Expectancy Population Region Year
40+
Country Region Year Population Life.Expectancy Health.Expenditure
4041
]
4142
end
4243

@@ -48,7 +49,7 @@
4849
nrows: 3988,
4950
index: (0..3987).to_a,
5051
order: %i[
51-
asvab bdate education height id income race sat_math sex weight
52+
id income height weight sex race education asvab sat_math bdate
5253
]
5354
end
5455

@@ -60,9 +61,13 @@
6061
nrows: 750,
6162
index: (0..749).to_a,
6263
order: %i[
63-
MxNum VisitNum airCanF airFelD airmus airnic coarse duBdRmBlaG duBdRmCanF duBdRmDerF duBdRmFelD
64-
duBdRmMusM duBdRmWeight duBedBlaG duBedCanF duBedDerF duBedFelD duBedMusM duBedWeight duKitchBlaG
65-
duKitchCanF duKitchDerF duKitchFelD duKitchMusM duKitchWeight no2 pm25
64+
MxNum VisitNum pm25 no2 airnic coarse
65+
duBedWeight duBdRmWeight duKitchWeight
66+
duBedBlaG duBdRmBlaG duKitchBlaG
67+
duBedMusM duBdRmMusM duKitchMusM airmus
68+
duBedFelD duBdRmFelD duKitchFelD airFelD
69+
duBedCanF duBdRmCanF duKitchCanF airCanF
70+
duBedDerF duBdRmDerF duKitchDerF
6671
]
6772
end
6873

@@ -74,34 +79,46 @@
7479
nrows: 168,
7580
index: (0..167).to_a,
7681
order: %i[
77-
1st.author.O 1st.author.R 80.power 90.power 95.power Actual.Power.O Analysis.completion.date.R
78-
Area.of.expertise.R Authors.O Calculated.P.value.O Citation.Count.1st.author.O
79-
Citation.count.1st.author.R Citation.count.paper.O Citation.count.senior.author.O
80-
Citation.count.senior.author.R Citations.R Coder.s.email.R Collect.materials.from.authors
81-
Completion.R Contact.Researcher.R Current.position.R Data.collection.quality.R Degree.R
82-
Description.of.effect.O Descriptors.O Differences.R Difficulty.of.implimentation.R Direction.R
83-
Discipline.O Domain.expertise.R Dummy Effect.Size.R Effect.similarity.R Effect.size.O
84-
Exciting.result.O Feasibility.O Findings.similarity.R Implementation.quality.R
85-
Institution.1st.author.O Institution.1st.author.R Institution.prestige.1st.author.O
86-
Institution.prestige.1st.author.R Institution.prestige.senior.author.O
87-
Institution.prestige.senior.author.R Institution.senior.author.O Institution.senior.author.R
88-
Internal.conceptual.replications.O Internal.direct.replications.O Issue.O Journal.O Local.ID
89-
Meta.analysis.significant Meta.analytic.estimate.Fz Method.expertise.R
90-
Methodology.expertise.required.O N.O N.R Notes.R Number.of.Authors.O Number.of.Authors.R
91-
Number.of.Research.sites.R Number.of.Studies.O Number.of.research.sites.O O.within.CI.R
92-
OSC.reviewer.O OSC.reviewer.R Opportunity.for.expectancy.bias.O Opportunity.for.lack.of.diligence.O
93-
Original.Author.s.Assessment P.value.R Pages.O Peer.reviewed.articles.R Planned.Power
94-
Planned.Sample Power.R Project.URL Project.audit.complete.R R.check.location.R Replicate.R
95-
Replicated.study.number.R Replication.similarity.R Reported.P.value.O Secondary.R Secondary.data.O
96-
Secondary.data.R Senior.author.O Senior.author.R Status.R Study.Title.O Study.claim.date.R
97-
Successful.conceptual.replications.O Successful.direct.replications.O Surprise.of.outcome.R
98-
Surprising.result.O T.Comparison.effects.R.O T.N.O T.N.O.for.tables T.N.R T.N.R.for.tables
99-
T.O.larger T.Test.Comparison.R T.Test.Statistic.O T.Test.Statistic.R T.Test.value.O T.Test.value.R
100-
T.TestComparison.O T.df1.O T.df1.R T.df2.O T.df2.R T.p.comparison.O T.p.comparison.R T.pval.O
101-
T.pval.R T.pval.USE.O T.pval.USE.R T.pval.recalc.O T.pval.recalc.R T.r.O T.r.R T.sign.O.113
102-
T.sign.O.131 T.sign.R.125 T.sign.R.132 Tails.O Tails.R Test.statistic.O Test.statistic.R
103-
Total.publications.R Type.of.analysis.O.128 Type.of.analysis.O.56 Type.of.analysis.R.129
104-
Type.of.analysis.R.74 Type.of.effect.O Type.of.effect.R V130 Volume.O Year.of.highest.degree.R
82+
Local.ID Study.Title.O Authors.O Journal.O Volume.O Issue.O Pages.O
83+
Project.URL Descriptors.O Number.of.Authors.O Number.of.Authors.R
84+
1st.author.O Citation.Count.1st.author.O Institution.1st.author.O
85+
Senior.author.O Citation.count.senior.author.O
86+
Institution.senior.author.O 1st.author.R Citation.count.1st.author.R
87+
Institution.1st.author.R Senior.author.R Citation.count.senior.author.R
88+
Institution.senior.author.R Citation.count.paper.O
89+
Institution.prestige.1st.author.O Institution.prestige.senior.author.O
90+
Institution.prestige.1st.author.R Institution.prestige.senior.author.R
91+
Number.of.Studies.O Discipline.O Number.of.research.sites.O
92+
Secondary.data.O Methodology.expertise.required.O
93+
Opportunity.for.expectancy.bias.O Opportunity.for.lack.of.diligence.O
94+
Surprising.result.O Exciting.result.O
95+
Internal.conceptual.replications.O Successful.conceptual.replications.O
96+
Internal.direct.replications.O Successful.direct.replications.O
97+
Feasibility.O Status.R Completion.R Secondary.R Contact.Researcher.R
98+
Study.claim.date.R Analysis.completion.date.R Coder.s.email.R
99+
Replicated.study.number.R Test.statistic.O N.O Reported.P.value.O
100+
Calculated.P.value.O Tails.O Type.of.analysis.O.56 Type.of.effect.O
101+
Description.of.effect.O Effect.size.O Actual.Power.O 80.power 90.power
102+
95.power Collect.materials.from.authors Planned.Sample Planned.Power
103+
Original.Author.s.Assessment OSC.reviewer.O Test.statistic.R N.R
104+
P.value.R Direction.R Tails.R Type.of.analysis.R.74 Type.of.effect.R
105+
Replicate.R Power.R Effect.Size.R OSC.reviewer.R Notes.R
106+
Project.audit.complete.R R.check.location.R Degree.R
107+
Year.of.highest.degree.R Current.position.R Domain.expertise.R
108+
Method.expertise.R Total.publications.R Peer.reviewed.articles.R
109+
Citations.R Implementation.quality.R Data.collection.quality.R
110+
Replication.similarity.R Differences.R Effect.similarity.R
111+
Findings.similarity.R Difficulty.of.implimentation.R
112+
Surprise.of.outcome.R Dummy Number.of.Research.sites.R
113+
Secondary.data.R Area.of.expertise.R T.N.O T.Test.Statistic.O
114+
T.TestComparison.O T.df1.O T.df2.O T.Test.value.O T.p.comparison.O
115+
T.pval.O T.pval.recalc.O T.pval.USE.O T.sign.O.113 T.r.O T.N.R
116+
T.Test.Statistic.R T.Test.Comparison.R T.df1.R T.df2.R T.Test.value.R
117+
T.p.comparison.R T.pval.R T.pval.recalc.R T.pval.USE.R T.sign.R.125
118+
T.r.R T.Comparison.effects.R.O Type.of.analysis.O.128
119+
Type.of.analysis.R.129 V130 T.sign.O.131 T.sign.R.132 T.O.larger
120+
T.N.O.for.tables T.N.R.for.tables Meta.analytic.estimate.Fz
121+
O.within.CI.R Meta.analysis.significant
105122
]
106123
end
107124
end

spec/daru/io/importers/sql_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
it_behaves_like 'exact daru dataframe',
1515
ncols: 3,
1616
nrows: 2,
17-
order: %i[age id name],
18-
data: [[20, 30],[1,2],%w[Homer Marge]]
17+
order: %i[id name age],
18+
data: [[1,2],%w[Homer Marge],[20, 30]]
1919
end
2020

2121
context 'with a database connection of ActiveRecord' do
@@ -28,8 +28,8 @@
2828
it_behaves_like 'exact daru dataframe',
2929
ncols: 3,
3030
nrows: 2,
31-
order: %i[age id name],
32-
data: [[20, 30],[1,2],%w[Homer Marge]]
31+
order: %i[id name age],
32+
data: [[1,2],%w[Homer Marge],[20, 30]]
3333
end
3434

3535
before { ActiveRecord::Base.establish_connection("sqlite3:#{db_name}") }
@@ -40,16 +40,16 @@
4040
it_behaves_like 'exact daru dataframe',
4141
ncols: 3,
4242
nrows: 2,
43-
order: %i[age id name],
44-
data: [[20, 30],[1,2],%w[Homer Marge]]
43+
order: %i[id name age],
44+
data: [[1,2],%w[Homer Marge],[20, 30]]
4545
end
4646

4747
context 'with ActiveRecord::Connection' do
4848
it_behaves_like 'exact daru dataframe',
4949
ncols: 3,
5050
nrows: 2,
51-
order: %i[age id name],
52-
data: [[20, 30],[1,2],%w[Homer Marge]]
51+
order: %i[id name age],
52+
data: [[1,2],%w[Homer Marge],[20, 30]]
5353
end
5454

5555
context 'with path to sqlite3 file' do
@@ -60,8 +60,8 @@
6060
it_behaves_like 'exact daru dataframe',
6161
ncols: 3,
6262
nrows: 2,
63-
order: %i[age id name],
64-
data: [[20, 30],[1,2],%w[Homer Marge]]
63+
order: %i[id name age],
64+
data: [[1,2],%w[Homer Marge],[20, 30]]
6565
end
6666

6767
context 'raises error for invalid arguments' do # rubocop:disable RSpec/EmptyExampleGroup

0 commit comments

Comments
 (0)