Skip to content

Commit 9afbb38

Browse files
authored
test california-housing: reduce checking (#222)
GitHub: GH-188 Because csv file is too big (20,640 rows). Before this change: ```console $ time ruby test/run-test.rb -t CaliforniaHousingTest --verbose=important-only Finished in 1.453959 seconds. 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications real 0m3.029s user 0m1.745s sys 0m0.161s ``` After this change: ```console $ time ruby test/run-test.rb -t CaliforniaHousingTest --verbose=important-only Finished in 0.331599 seconds. 2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications real 0m1.126s user 0m0.738s sys 0m0.143s ```
1 parent 81fd2c9 commit 9afbb38

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

test/test-california-housing.rb

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,18 @@ def record(*args)
88
end
99

1010
test("#each") do
11-
records = @dataset.each.to_a
12-
assert_equal([
13-
20640,
14-
{
15-
median_house_value: 452600.000000,
16-
median_income: 8.325200,
17-
housing_median_age: 41.000000,
18-
total_rooms: 880.000000,
19-
total_bedrooms: 129.000000,
20-
population: 322.000000,
21-
households: 126.000000,
22-
latitude: 37.880000,
23-
longitude: -122.230000
24-
},
25-
{
26-
median_house_value: 89400.000000,
27-
median_income: 2.388600,
28-
housing_median_age: 16.000000,
29-
total_rooms: 2785.000000,
30-
total_bedrooms: 616.000000,
31-
population: 1387.000000,
32-
households: 530.000000,
33-
latitude: 39.370000,
34-
longitude: -121.240000
35-
},
36-
],
37-
[
38-
records.size,
39-
records[0].to_h,
40-
records[-1].to_h
41-
])
11+
assert_equal({
12+
median_house_value: 452600.000000,
13+
median_income: 8.325200,
14+
housing_median_age: 41.000000,
15+
total_rooms: 880.000000,
16+
total_bedrooms: 129.000000,
17+
population: 322.000000,
18+
households: 126.000000,
19+
latitude: 37.880000,
20+
longitude: -122.230000,
21+
},
22+
@dataset.each.next.to_h)
4223
end
4324

4425
sub_test_case("#metadata") do

0 commit comments

Comments
 (0)