|
18 | 18 | let(:path) { 'spec/fixtures/csv/matrix_test.csv' } |
19 | 19 | let(:opts) { {col_sep: ' ', headers: true} } |
20 | 20 |
|
21 | | - context 'loads from a CSV file' do |
| 21 | + context 'when loads from a CSV file' do |
22 | 22 | let('subject.vectors') { %I[image_resolution mls true_transform].to_index } |
23 | 23 |
|
24 | 24 | it_behaves_like 'exact daru dataframe', |
|
31 | 31 | ',-0.3027024,4262.65,0,0,0,1' |
32 | 32 | end |
33 | 33 |
|
34 | | - context 'works properly for repeated headers' do |
| 34 | + context 'when works properly for repeated headers' do |
35 | 35 | let(:path) { 'spec/fixtures/csv/repeated_fields.csv' } |
36 | 36 | let(:opts) { {header_converters: :symbol} } |
37 | 37 |
|
|
42 | 42 | age_2: Daru::Vector.new([3, 4, 5, 6, nil, 8]) |
43 | 43 | end |
44 | 44 |
|
45 | | - context 'accepts scientific notation as float' do |
| 45 | + context 'when accepts scientific notation as float' do |
46 | 46 | let(:path) { 'spec/fixtures/csv/scientific_notation.csv' } |
47 | 47 | let(:opts) { {order: %w[x y]} } |
48 | 48 | let(:df) { subject } |
|
64 | 64 | end |
65 | 65 | end |
66 | 66 |
|
67 | | - context 'follows the order of columns given in CSV' do |
| 67 | + context 'when follows the order of columns given in CSV' do |
68 | 68 | let(:path) { 'spec/fixtures/csv/sales-funnel.csv' } |
69 | 69 | let(:opts) { {} } |
70 | 70 |
|
|
74 | 74 | order: %w[Account Name Rep Manager Product Quantity Price Status] |
75 | 75 | end |
76 | 76 |
|
77 | | - context 'parses empty dataframe from CSV with only headers' do |
| 77 | + context 'when parses empty dataframe from CSV with only headers' do |
78 | 78 | let(:path) { 'spec/fixtures/csv/column_headers_only.csv' } |
79 | 79 | let(:opts) { {} } |
80 | 80 |
|
|
84 | 84 | order: %w[col0 col1 col2] |
85 | 85 | end |
86 | 86 |
|
87 | | - context 'skips rows from CSV files with headers option' do |
| 87 | + context 'when skips rows from CSV files with headers option' do |
88 | 88 | let(:path) { 'spec/fixtures/csv/sales-funnel.csv' } |
89 | 89 | let(:opts) { {skiprows: 8, headers: true} } |
90 | 90 |
|
|
94 | 94 | order: %i[account manager name price product quantity rep status] |
95 | 95 | end |
96 | 96 |
|
97 | | - context 'skips rows from CSV files without headers option' do |
| 97 | + context 'when skips rows from CSV files without headers option' do |
98 | 98 | let(:path) { 'spec/fixtures/csv/sales-funnel.csv' } |
99 | 99 | let(:opts) { {skiprows: 8} } |
100 | 100 |
|
|
104 | 104 | order: %w[Account Name Rep Manager Product Quantity Price Status] |
105 | 105 | end |
106 | 106 |
|
107 | | - context 'checks for boolean converter' do |
| 107 | + context 'when checks for boolean converter' do |
108 | 108 | let(:path) { 'spec/fixtures/csv/boolean_converter_test.csv' } |
109 | 109 | let(:opts) { {converters: [:boolean]} } |
110 | 110 |
|
|
114 | 114 | its('Domestic.to_a') { is_expected.to all be_boolean } |
115 | 115 | end |
116 | 116 |
|
117 | | - context 'checks for skip_blanks option to skip empty rows' do |
| 117 | + context 'when checks for skip_blanks option to skip empty rows' do |
118 | 118 | let(:path) { 'spec/fixtures/csv/empty_rows_test.csv' } |
119 | 119 |
|
120 | 120 | it_behaves_like 'exact daru dataframe', |
121 | 121 | ncols: 3, |
122 | 122 | nrows: 13 |
123 | 123 | end |
124 | 124 |
|
125 | | - context 'checks for equal parsing of csv and csv.gz files' do |
| 125 | + context 'when checks for equal parsing of csv and csv.gz files' do |
126 | 126 | ALL_CSV_FILES.each do |file| |
127 | 127 | before { Zlib::GzipWriter.open(path) { |gz| gz.write File.read(csv_path) } } |
128 | 128 |
|
|
137 | 137 | end |
138 | 138 | end |
139 | 139 |
|
140 | | - context 'checks for equal parsing of local CSV files and remote CSV files' do |
| 140 | + context 'when checks for equal parsing of local CSV files and remote CSV files' do |
141 | 141 | ALL_CSV_FILES.each do |file| |
142 | 142 | let(:local) { described_class.read("spec/fixtures/csv/#{file}.csv").call } |
143 | 143 | let(:path) { "http://dummy-remote-url/#{file}.csv" } |
|
0 commit comments