Skip to content

Commit 34e9aa7

Browse files
committed
Ensure super are called in set up and initialize
1 parent 35913a9 commit 34e9aa7

9 files changed

+94
-95
lines changed

src/DataFrame-IO-Tests/DataFrameCsvReaderTest.class.st

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,52 @@ DataFrameCsvReaderTest >> createFile: aFileReference withContents: aString [
2323

2424
{ #category : #running }
2525
DataFrameCsvReaderTest >> setUp [
26+
27+
super setUp.
2628
directory := FileSystem memory workingDirectory / 'testData'.
2729
directory createDirectory.
28-
30+
2931
commaCsvFile := directory / 'comma.csv'.
30-
tabCsvFile := directory / 'tab.csv'.
31-
emptyCsvFile := directory / 'empty.csv'.
32-
32+
tabCsvFile := directory / 'tab.csv'.
33+
emptyCsvFile := directory / 'empty.csv'.
34+
3335
self createFile: commaCsvFile withContents: TestCsvStrings commaCsvString.
3436
self createFile: tabCsvFile withContents: TestCsvStrings tabCsvString.
3537
self createFile: emptyCsvFile withContents: TestCsvStrings emptyCsvString.
36-
37-
dataFrameWithRowNames := DataFrame withRows: #(
38-
(2.4 true 'rain')
39-
(0.5 true 'rain')
40-
(-1.2 true 'snow')
41-
(-2.3 false '-')
42-
(3.2 true 'rain')).
43-
44-
dataFrameWithRowNames columnNames: #(temperature precipitation type).
45-
dataFrameWithRowNames rowNames: (#('01:10' '01:30' '01:50' '02:10' '02:30')
46-
collect: #asTime).
47-
38+
39+
dataFrameWithRowNames := DataFrame withRows: #( #( 2.4 true 'rain' ) #( 0.5 true 'rain' ) #( -1.2 true 'snow' ) #( -2.3 false '-' ) #( 3.2 true 'rain' ) ).
40+
41+
dataFrameWithRowNames columnNames: #( temperature precipitation type ).
42+
dataFrameWithRowNames rowNames: (#( '01:10' '01:30' '01:50' '02:10' '02:30' ) collect: #asTime).
43+
4844
dataFrameWithoutRowNames := DataFrame withRows: {
49-
{ '01:10' asTime . 2.4 . true . 'rain' } .
50-
{ '01:30' asTime . 0.5 . true . 'rain' } .
51-
{ '01:50' asTime . -1.2 . true . 'snow' } .
52-
{ '02:10' asTime . -2.3 . false . '-' } .
53-
{ '02:30' asTime . 3.2 . true . 'rain' }}.
54-
55-
dataFrameWithoutRowNames columnNames: #(nil temperature precipitation type).
45+
{
46+
'01:10' asTime.
47+
2.4.
48+
true.
49+
'rain' }.
50+
{
51+
'01:30' asTime.
52+
0.5.
53+
true.
54+
'rain' }.
55+
{
56+
'01:50' asTime.
57+
-1.2.
58+
true.
59+
'snow' }.
60+
{
61+
'02:10' asTime.
62+
-2.3.
63+
false.
64+
'-' }.
65+
{
66+
'02:30' asTime.
67+
3.2.
68+
true.
69+
'rain' } }.
70+
71+
dataFrameWithoutRowNames columnNames: #( nil temperature precipitation type )
5672
]
5773

5874
{ #category : #tests }

src/DataFrame-IO-Tests/DataFrameCsvWriterTest.class.st

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,18 @@ DataFrameCsvWriterTest >> readFile: aFileReference [
2121

2222
{ #category : #running }
2323
DataFrameCsvWriterTest >> setUp [
24+
25+
super setUp.
2426
directory := FileSystem memory workingDirectory / 'testData'.
2527
directory createDirectory.
26-
28+
2729
commaQuoteCsvFile := directory / 'commaQuote.csv'.
28-
tabQuoteCsvFile := directory / 'tabQuote.csv'.
29-
30-
dataFrame := DataFrame withRows: #(
31-
(2.4 true 'rain')
32-
(0.5 true 'rain')
33-
(-1.2 true 'snow')
34-
(-2.3 false '-')
35-
(3.2 true 'rain')).
36-
37-
dataFrame columnNames: #(temperature precipitation type).
38-
dataFrame rowNames: (#('01:10' '01:30' '01:50' '02:10' '02:30')
39-
collect: #asTime).
30+
tabQuoteCsvFile := directory / 'tabQuote.csv'.
31+
32+
dataFrame := DataFrame withRows: #( #( 2.4 true 'rain' ) #( 0.5 true 'rain' ) #( -1.2 true 'snow' ) #( -2.3 false '-' ) #( 3.2 true 'rain' ) ).
33+
34+
dataFrame columnNames: #( temperature precipitation type ).
35+
dataFrame rowNames: (#( '01:10' '01:30' '01:50' '02:10' '02:30' ) collect: #asTime)
4036
]
4137

4238
{ #category : #tests }

src/DataFrame-Tests/DataFrameAggrGroupTest.class.st

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ Class {
1010
{ #category : #running }
1111
DataFrameAggrGroupTest >> setUp [
1212

13-
df := DataFrame withRows: #(
14-
(16.99 1.01 Female No Sun Dinner 2)
15-
(10.34 1.66 Male No Sun Dinner 3)
16-
(21.01 3.5 Male No Sun Dinner 3)
17-
(23.68 3.31 Male No Sun Dinner 2)
18-
(24.59 3.61 Female No Sun Dinner 4)).
19-
20-
df columnNames: #(total_bill tip sex smoker day time size).
13+
super setUp.
14+
15+
df := DataFrame withRows:
16+
#( #( 16.99 1.01 Female No Sun Dinner 2 ) #( 10.34 1.66 Male No Sun Dinner 3 ) #( 21.01 3.5 Male No Sun Dinner 3 ) #( 23.68 3.31 Male No Sun Dinner
17+
2 ) #( 24.59 3.61 Female No Sun Dinner 4 ) ).
18+
19+
df columnNames: #( total_bill tip sex smoker day time size )
2120
]
2221

2322
{ #category : #tests }

src/DataFrame-Tests/DataFrameHeadTailTest.class.st

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@ Class {
1111
{ #category : #running }
1212
DataFrameHeadTailTest >> setUp [
1313

14-
df := DataFrame withRows: #(
15-
(5.1 3.5 1.4 0.2 setosa)
16-
(4.9 3 1.4 0.2 setosa)
17-
(4.7 3.2 1.3 0.2 setosa)
18-
(7 3.2 4.7 1.4 versicolor)
19-
(6.4 3.2 4.5 1.5 versicolor)
20-
(6.9 3.1 4.9 1.5 versicolor)
21-
(6.3 3.3 6 2.5 virginica)
22-
(5.8 2.7 5.1 1.9 virginica)
23-
(7.1 3 5.9 2.1 virginica)).
24-
25-
df columnNames: #(sepalLength sepalWidth petalLength petalWidth species).
26-
series := df column: #sepalLength.
14+
super setUp.
15+
16+
df := DataFrame withRows:
17+
#( #( 5.1 3.5 1.4 0.2 setosa ) #( 4.9 3 1.4 0.2 setosa ) #( 4.7 3.2 1.3 0.2 setosa ) #( 7 3.2 4.7 1.4 versicolor ) #( 6.4 3.2 4.5 1.5 versicolor )
18+
#( 6.9 3.1 4.9 1.5 versicolor ) #( 6.3 3.3 6 2.5 virginica ) #( 5.8 2.7 5.1 1.9 virginica ) #( 7.1 3 5.9 2.1 virginica ) ).
19+
20+
df columnNames: #( sepalLength sepalWidth petalLength petalWidth species ).
21+
series := df column: #sepalLength
2722
]
2823

2924
{ #category : #tests }

src/DataFrame-Tests/DataFrameInternalTest.class.st

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ Class {
1010
{ #category : #running }
1111
DataFrameInternalTest >> setUp [
1212

13-
df := DataFrameInternal withRows: #(
14-
('Barcelona' 1.609 true)
15-
('Dubai' 2.789 true)
16-
('London' 8.788 false)).
13+
super setUp.
14+
15+
df := DataFrameInternal withRows: #( #( 'Barcelona' 1.609 true ) #( 'Dubai' 2.789 true ) #( 'London' 8.788 false ) )
1716
]
1817

1918
{ #category : #tests }

src/DataFrame-Tests/DataFrameStatsTest.class.st

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ Class {
1010
{ #category : #running }
1111
DataFrameStatsTest >> setUp [
1212

13-
df := DataFrame withRows: #(
14-
(7.1 3.5 1.4 0.2)
15-
(4.9 3 1.4 0.2)
16-
(4.7 3.2 1.3 0.2)
17-
(7 3.2 4.7 1.4)
18-
(6.4 3.2 4.5 1.5)
19-
(6.9 3.1 4.9 1.5)
20-
(6.3 3.3 6 2.5)
21-
(5.8 2.7 5.1 1.9)
22-
(7.1 3 5.9 2.1)).
23-
24-
df columnNames: #(sepalLength sepalWidth petalLength petalWidth).
13+
super setUp.
14+
15+
df := DataFrame withRows:
16+
#( #( 7.1 3.5 1.4 0.2 ) #( 4.9 3 1.4 0.2 ) #( 4.7 3.2 1.3 0.2 ) #( 7 3.2 4.7 1.4 ) #( 6.4 3.2 4.5 1.5 ) #( 6.9 3.1 4.9 1.5 ) #( 6.3 3.3 6 2.5 )
17+
#( 5.8 2.7 5.1 1.9 ) #( 7.1 3 5.9 2.1 ) ).
18+
19+
df columnNames: #( sepalLength sepalWidth petalLength petalWidth )
2520
]
2621

2722
{ #category : #tests }

src/DataFrame-Tests/DataFrameTest.class.st

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ Class {
1010
{ #category : #running }
1111
DataFrameTest >> setUp [
1212

13-
df := DataFrame withRows: #(
14-
('Barcelona' 1.609 true)
15-
('Dubai' 2.789 true)
16-
('London' 8.788 false)).
17-
18-
df rowNames: #('A' 'B' 'C').
19-
df columnNames: #('City' 'Population' 'BeenThere').
13+
super setUp.
14+
15+
df := DataFrame withRows: #( #( 'Barcelona' 1.609 true ) #( 'Dubai' 2.789 true ) #( 'London' 8.788 false ) ).
16+
17+
df rowNames: #( 'A' 'B' 'C' ).
18+
df columnNames: #( 'City' 'Population' 'BeenThere' )
2019
]
2120

2221
{ #category : #tests }

src/DataFrame-Tests/DataSeriesTest.class.st

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ Class {
1010

1111
{ #category : #running }
1212
DataSeriesTest >> setUp [
13-
keyArray := #(a b c d e f g h i j k).
14-
15-
series := DataSeries
16-
withKeys: keyArray
17-
values: #(3 7 6 20 8 9 8 10 15 13 16)
18-
name: 'ExampleSeries'.
13+
14+
super setUp.
15+
keyArray := #( a b c d e f g h i j k ).
16+
17+
series := DataSeries withKeys: keyArray values: #( 3 7 6 20 8 9 8 10 15 13 16 ) name: 'ExampleSeries'
1918
]
2019

2120
{ #category : #arithmetic }

src/DataFrame-Type/DataFrameTypeDetector.class.st

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ DataFrameTypeDetector >> detectTypesAndConvert: aDataFrame [
165165

166166
{ #category : #initialization }
167167
DataFrameTypeDetector >> initialize [
168+
169+
super initialize.
168170
columnTypes := Dictionary new.
169-
typeMapping := Dictionary
170-
newFrom:
171-
{(Boolean -> [ :array | self convertToBoolean: array ]).
172-
(Float -> [ :array | self convertToFloat: array ]).
173-
(Integer -> [ :array | self convertToInteger: array ]).
174-
(Time -> [ :array | self convertToTime: array ]).
175-
(DateAndTime -> [ :array | self convertToDateAndTime: array ]).
176-
(String -> [ :array | array ]).
177-
(nil -> [ :array | self detectColumnTypeAndConvert: array ])}.
171+
typeMapping := Dictionary newFrom: {
172+
(Boolean -> [ :array | self convertToBoolean: array ]).
173+
(Float -> [ :array | self convertToFloat: array ]).
174+
(Integer -> [ :array | self convertToInteger: array ]).
175+
(Time -> [ :array | self convertToTime: array ]).
176+
(DateAndTime -> [ :array | self convertToDateAndTime: array ]).
177+
(String -> [ :array | array ]).
178+
(nil -> [ :array | self detectColumnTypeAndConvert: array ]) }
178179
]

0 commit comments

Comments
 (0)