@@ -40,49 +40,24 @@ def record(*args)
40
40
end
41
41
42
42
test ( "#each" ) do
43
- records = @dataset . each . to_a
44
- assert_equal ( [
45
- 16281 ,
46
- {
47
- :age => 25 ,
48
- :work_class => "Private" ,
49
- :final_weight => 226802 ,
50
- :education => "11th" ,
51
- :n_education_years => 7 ,
52
- :marital_status => "Never-married" ,
53
- :occupation => "Machine-op-inspct" ,
54
- :relationship => "Own-child" ,
55
- :race => "Black" ,
56
- :sex => "Male" ,
57
- :capital_gain => 0 ,
58
- :capital_loss => 0 ,
59
- :hours_per_week => 40 ,
60
- :native_country => "United-States" ,
61
- :label => "<=50K."
62
- } ,
63
- {
64
- :age => 35 ,
65
- :work_class => "Self-emp-inc" ,
66
- :final_weight => 182148 ,
67
- :education => "Bachelors" ,
68
- :n_education_years => 13 ,
69
- :marital_status => "Married-civ-spouse" ,
70
- :occupation => "Exec-managerial" ,
71
- :relationship => "Husband" ,
72
- :race => "White" ,
73
- :sex => "Male" ,
74
- :capital_gain => 0 ,
75
- :capital_loss => 0 ,
76
- :hours_per_week => 60 ,
77
- :native_country => "United-States" ,
78
- :label => ">50K."
79
- }
80
- ] ,
81
- [
82
- records . size ,
83
- records [ 0 ] . to_h ,
84
- records [ -1 ] . to_h
85
- ] )
43
+ assert_equal ( {
44
+ :age => 25 ,
45
+ :work_class => "Private" ,
46
+ :final_weight => 226802 ,
47
+ :education => "11th" ,
48
+ :n_education_years => 7 ,
49
+ :marital_status => "Never-married" ,
50
+ :occupation => "Machine-op-inspct" ,
51
+ :relationship => "Own-child" ,
52
+ :race => "Black" ,
53
+ :sex => "Male" ,
54
+ :capital_gain => 0 ,
55
+ :capital_loss => 0 ,
56
+ :hours_per_week => 40 ,
57
+ :native_country => "United-States" ,
58
+ :label => "<=50K." ,
59
+ } ,
60
+ @dataset . each . next . to_h )
86
61
end
87
62
end
88
63
0 commit comments