sportdb-formats 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,212 +1,212 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_club_reader_history.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestClubHistoryReader < MiniTest::Test
12
-
13
- def test_parse_eng
14
- txt =<<TXT
15
- = England
16
-
17
- ## note: use history log by season (instead of by year) - why? why not?
18
- ##
19
- ## note/warn/remember !! a line starting with arrow (=>)
20
- ## will get turned into a heading 1!!!
21
- ## as an ascii-alternative to ⇒ use >> or -> or ??? - why? why not?
22
-
23
-
24
-
25
- == 1958/9
26
- RENAME Scunthorpe & Lindsey United FC, Scunthorpe ⇒ Scunthorpe United FC
27
-
28
- == 1946/7
29
- RENAME Clapton Orient FC, London ⇒ Leyton Orient FC
30
-
31
- == 1945/6
32
- RENAME Birmingham FC, Birmingham ⇒ Birmingham City FC
33
-
34
- == 1930/1
35
- MOVE South Shields FC, South Shields ⇒ Gateshead FC, Gateshead
36
-
37
-
38
-
39
- == 1929/30
40
- RENAME The Wednesday FC, Sheffield ⇒ Sheffield Wednesday
41
-
42
- == 1927/8
43
- RENAME The Arsenal FC, London ⇒ Arsenal FC
44
-
45
- == 1925/6
46
- RENAME Millwall Athletic FC, London ⇒ Millwall FC
47
- Stoke FC, Stoke-on-Trent ⇒ Stoke City FC
48
-
49
- MERGE Rotherham County FC, Rotherham
50
- Rotherham Town FC, Rotherham
51
- ⇒ Rotherham United FC
52
-
53
- == 1914/5
54
- RENAME Woolwich Arsenal FC, London ⇒ The Arsenal FC
55
-
56
-
57
- == 1911/2
58
- REFORM Burslem Port Vale FC, Burslem ⇒ Port Vale FC, Stoke-on-Trent
59
- ## the towns of Burslem having been merged in 1910 with the towns of Fenton, Hanley,
60
- ## Longton, Stoke-upon-Trent and Tunstall as the city of Stoke-on-Trent
61
-
62
-
63
- == 1909/10
64
- RENAME Chesterfield Town FC, Chesterfield ⇒ Chesterfield FC
65
-
66
-
67
- == 1905/6
68
- RENAME Chesterfield FC, Chesterfield ⇒ Chesterfield Town FC
69
- Small Heath FC, Birmingham ⇒ Birmingham FC
70
-
71
- == 1902/3
72
- REFORM Newton Heath FC, Manchester ⇒ Manchester United
73
-
74
- == 1901/2
75
- MERGE Burton Swifts FC, Burton-upon-Trent
76
- Burton Wanderers FC, Burton-upon-Trent
77
- ⇒ Burton United FC
78
-
79
- BANKRUPT Newton Heath FC, Manchester
80
-
81
-
82
- == 1899/00
83
- RENAME Barnsley St. Peter's FC, Barnsley ⇒ Barnsley FC
84
-
85
- MERGE Blackpool FC, Blackpool
86
- South Shore FC, Blackpool
87
- ⇒ Blackpool FC
88
-
89
- == 1898/9
90
- RENAME Glossop North End FC, Glossop ⇒ Glossop FC
91
-
92
-
93
- == 1895/6
94
- RENAME Walsall Town Swifts FC, Walsall ⇒ Walsall FC
95
-
96
-
97
- == 1894/5
98
- REFORM Ardwick FC, Manchester ⇒ Manchester City FC
99
-
100
- == 1893/4
101
- BANKRUPT Ardwick FC, Manchester
102
-
103
- MERGE Newcastle West End FC, Newcastle-upon-Tyne
104
- Newcastle East End FC, Newcastle-upon-Tyne
105
- ⇒ Newcastle United FC
106
-
107
- == 1892/3
108
- RENAME Royal Arsenal FC, London ⇒ Woolwich Arsenal FC
109
- TXT
110
-
111
- recs = SportDb::Import::ClubHistoryReader.parse( txt )
112
-
113
- pp recs
114
-
115
- exp = [["RENAME", "1958/59",
116
- ["Scunthorpe & Lindsey United FC, Scunthorpe", "eng"],
117
- ["Scunthorpe United FC", "eng"]],
118
- ["RENAME", "1946/47",
119
- ["Clapton Orient FC, London", "eng"],
120
- ["Leyton Orient FC", "eng"]],
121
- ["RENAME", "1945/46",
122
- ["Birmingham FC, Birmingham", "eng"],
123
- ["Birmingham City FC", "eng"]],
124
- ["MOVE", "1930/31",
125
- ["South Shields FC, South Shields", "eng"],
126
- ["Gateshead FC, Gateshead", "eng"]],
127
- ["RENAME",
128
- "1929/30",
129
- ["The Wednesday FC, Sheffield", "eng"],
130
- ["Sheffield Wednesday", "eng"]],
131
- ["RENAME",
132
- "1927/28",
133
- ["The Arsenal FC, London", "eng"],
134
- ["Arsenal FC", "eng"]],
135
- ["RENAME",
136
- "1925/26",
137
- ["Millwall Athletic FC, London", "eng"],
138
- ["Millwall FC", "eng"]],
139
- ["RENAME",
140
- "1925/26",
141
- ["Stoke FC, Stoke-on-Trent", "eng"],
142
- ["Stoke City FC", "eng"]],
143
- ["MERGE",
144
- "1925/26",
145
- [["Rotherham County FC, Rotherham", "eng"],
146
- ["Rotherham Town FC, Rotherham", "eng"]],
147
- ["Rotherham United FC", "eng"]],
148
- ["RENAME",
149
- "1914/15",
150
- ["Woolwich Arsenal FC, London", "eng"],
151
- ["The Arsenal FC", "eng"]],
152
- ["REFORM",
153
- "1911/12",
154
- ["Burslem Port Vale FC, Burslem", "eng"],
155
- ["Port Vale FC, Stoke-on-Trent", "eng"]],
156
- ["RENAME",
157
- "1909/10",
158
- ["Chesterfield Town FC, Chesterfield", "eng"],
159
- ["Chesterfield FC", "eng"]],
160
- ["RENAME",
161
- "1905/06",
162
- ["Chesterfield FC, Chesterfield", "eng"],
163
- ["Chesterfield Town FC", "eng"]],
164
- ["RENAME",
165
- "1905/06",
166
- ["Small Heath FC, Birmingham", "eng"],
167
- ["Birmingham FC", "eng"]],
168
- ["REFORM",
169
- "1902/03",
170
- ["Newton Heath FC, Manchester", "eng"],
171
- ["Manchester United", "eng"]],
172
- ["MERGE",
173
- "1901/02",
174
- [["Burton Swifts FC, Burton-upon-Trent", "eng"],
175
- ["Burton Wanderers FC, Burton-upon-Trent", "eng"]],
176
- ["Burton United FC", "eng"]],
177
- ["BANKRUPT", "1901/02", ["Newton Heath FC, Manchester", "eng"]],
178
- ["RENAME",
179
- "1899/00",
180
- ["Barnsley St. Peter's FC, Barnsley", "eng"],
181
- ["Barnsley FC", "eng"]],
182
- ["MERGE",
183
- "1899/00",
184
- [["Blackpool FC, Blackpool", "eng"], ["South Shore FC, Blackpool", "eng"]],
185
- ["Blackpool FC", "eng"]],
186
- ["RENAME",
187
- "1898/99",
188
- ["Glossop North End FC, Glossop", "eng"],
189
- ["Glossop FC", "eng"]],
190
- ["RENAME",
191
- "1895/96",
192
- ["Walsall Town Swifts FC, Walsall", "eng"],
193
- ["Walsall FC", "eng"]],
194
- ["REFORM",
195
- "1894/95",
196
- ["Ardwick FC, Manchester", "eng"],
197
- ["Manchester City FC", "eng"]],
198
- ["BANKRUPT", "1893/94", ["Ardwick FC, Manchester", "eng"]],
199
- ["MERGE",
200
- "1893/94",
201
- [["Newcastle West End FC, Newcastle-upon-Tyne", "eng"],
202
- ["Newcastle East End FC, Newcastle-upon-Tyne", "eng"]],
203
- ["Newcastle United FC", "eng"]],
204
- ["RENAME",
205
- "1892/93",
206
- ["Royal Arsenal FC, London", "eng"],
207
- ["Woolwich Arsenal FC", "eng"]]]
208
-
209
- assert_equal exp, recs
210
- end
211
-
212
- end # class TestClubHistoryReader
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_club_reader_history.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestClubHistoryReader < MiniTest::Test
12
+
13
+ def test_parse_eng
14
+ txt =<<TXT
15
+ = England
16
+
17
+ ## note: use history log by season (instead of by year) - why? why not?
18
+ ##
19
+ ## note/warn/remember !! a line starting with arrow (=>)
20
+ ## will get turned into a heading 1!!!
21
+ ## as an ascii-alternative to ⇒ use >> or -> or ??? - why? why not?
22
+
23
+
24
+
25
+ == 1958/9
26
+ RENAME Scunthorpe & Lindsey United FC, Scunthorpe ⇒ Scunthorpe United FC
27
+
28
+ == 1946/7
29
+ RENAME Clapton Orient FC, London ⇒ Leyton Orient FC
30
+
31
+ == 1945/6
32
+ RENAME Birmingham FC, Birmingham ⇒ Birmingham City FC
33
+
34
+ == 1930/1
35
+ MOVE South Shields FC, South Shields ⇒ Gateshead FC, Gateshead
36
+
37
+
38
+
39
+ == 1929/30
40
+ RENAME The Wednesday FC, Sheffield ⇒ Sheffield Wednesday
41
+
42
+ == 1927/8
43
+ RENAME The Arsenal FC, London ⇒ Arsenal FC
44
+
45
+ == 1925/6
46
+ RENAME Millwall Athletic FC, London ⇒ Millwall FC
47
+ Stoke FC, Stoke-on-Trent ⇒ Stoke City FC
48
+
49
+ MERGE Rotherham County FC, Rotherham
50
+ Rotherham Town FC, Rotherham
51
+ ⇒ Rotherham United FC
52
+
53
+ == 1914/5
54
+ RENAME Woolwich Arsenal FC, London ⇒ The Arsenal FC
55
+
56
+
57
+ == 1911/2
58
+ REFORM Burslem Port Vale FC, Burslem ⇒ Port Vale FC, Stoke-on-Trent
59
+ ## the towns of Burslem having been merged in 1910 with the towns of Fenton, Hanley,
60
+ ## Longton, Stoke-upon-Trent and Tunstall as the city of Stoke-on-Trent
61
+
62
+
63
+ == 1909/10
64
+ RENAME Chesterfield Town FC, Chesterfield ⇒ Chesterfield FC
65
+
66
+
67
+ == 1905/6
68
+ RENAME Chesterfield FC, Chesterfield ⇒ Chesterfield Town FC
69
+ Small Heath FC, Birmingham ⇒ Birmingham FC
70
+
71
+ == 1902/3
72
+ REFORM Newton Heath FC, Manchester ⇒ Manchester United
73
+
74
+ == 1901/2
75
+ MERGE Burton Swifts FC, Burton-upon-Trent
76
+ Burton Wanderers FC, Burton-upon-Trent
77
+ ⇒ Burton United FC
78
+
79
+ BANKRUPT Newton Heath FC, Manchester
80
+
81
+
82
+ == 1899/00
83
+ RENAME Barnsley St. Peter's FC, Barnsley ⇒ Barnsley FC
84
+
85
+ MERGE Blackpool FC, Blackpool
86
+ South Shore FC, Blackpool
87
+ ⇒ Blackpool FC
88
+
89
+ == 1898/9
90
+ RENAME Glossop North End FC, Glossop ⇒ Glossop FC
91
+
92
+
93
+ == 1895/6
94
+ RENAME Walsall Town Swifts FC, Walsall ⇒ Walsall FC
95
+
96
+
97
+ == 1894/5
98
+ REFORM Ardwick FC, Manchester ⇒ Manchester City FC
99
+
100
+ == 1893/4
101
+ BANKRUPT Ardwick FC, Manchester
102
+
103
+ MERGE Newcastle West End FC, Newcastle-upon-Tyne
104
+ Newcastle East End FC, Newcastle-upon-Tyne
105
+ ⇒ Newcastle United FC
106
+
107
+ == 1892/3
108
+ RENAME Royal Arsenal FC, London ⇒ Woolwich Arsenal FC
109
+ TXT
110
+
111
+ recs = SportDb::Import::ClubHistoryReader.parse( txt )
112
+
113
+ pp recs
114
+
115
+ exp = [["RENAME", "1958/59",
116
+ ["Scunthorpe & Lindsey United FC, Scunthorpe", "eng"],
117
+ ["Scunthorpe United FC", "eng"]],
118
+ ["RENAME", "1946/47",
119
+ ["Clapton Orient FC, London", "eng"],
120
+ ["Leyton Orient FC", "eng"]],
121
+ ["RENAME", "1945/46",
122
+ ["Birmingham FC, Birmingham", "eng"],
123
+ ["Birmingham City FC", "eng"]],
124
+ ["MOVE", "1930/31",
125
+ ["South Shields FC, South Shields", "eng"],
126
+ ["Gateshead FC, Gateshead", "eng"]],
127
+ ["RENAME",
128
+ "1929/30",
129
+ ["The Wednesday FC, Sheffield", "eng"],
130
+ ["Sheffield Wednesday", "eng"]],
131
+ ["RENAME",
132
+ "1927/28",
133
+ ["The Arsenal FC, London", "eng"],
134
+ ["Arsenal FC", "eng"]],
135
+ ["RENAME",
136
+ "1925/26",
137
+ ["Millwall Athletic FC, London", "eng"],
138
+ ["Millwall FC", "eng"]],
139
+ ["RENAME",
140
+ "1925/26",
141
+ ["Stoke FC, Stoke-on-Trent", "eng"],
142
+ ["Stoke City FC", "eng"]],
143
+ ["MERGE",
144
+ "1925/26",
145
+ [["Rotherham County FC, Rotherham", "eng"],
146
+ ["Rotherham Town FC, Rotherham", "eng"]],
147
+ ["Rotherham United FC", "eng"]],
148
+ ["RENAME",
149
+ "1914/15",
150
+ ["Woolwich Arsenal FC, London", "eng"],
151
+ ["The Arsenal FC", "eng"]],
152
+ ["REFORM",
153
+ "1911/12",
154
+ ["Burslem Port Vale FC, Burslem", "eng"],
155
+ ["Port Vale FC, Stoke-on-Trent", "eng"]],
156
+ ["RENAME",
157
+ "1909/10",
158
+ ["Chesterfield Town FC, Chesterfield", "eng"],
159
+ ["Chesterfield FC", "eng"]],
160
+ ["RENAME",
161
+ "1905/06",
162
+ ["Chesterfield FC, Chesterfield", "eng"],
163
+ ["Chesterfield Town FC", "eng"]],
164
+ ["RENAME",
165
+ "1905/06",
166
+ ["Small Heath FC, Birmingham", "eng"],
167
+ ["Birmingham FC", "eng"]],
168
+ ["REFORM",
169
+ "1902/03",
170
+ ["Newton Heath FC, Manchester", "eng"],
171
+ ["Manchester United", "eng"]],
172
+ ["MERGE",
173
+ "1901/02",
174
+ [["Burton Swifts FC, Burton-upon-Trent", "eng"],
175
+ ["Burton Wanderers FC, Burton-upon-Trent", "eng"]],
176
+ ["Burton United FC", "eng"]],
177
+ ["BANKRUPT", "1901/02", ["Newton Heath FC, Manchester", "eng"]],
178
+ ["RENAME",
179
+ "1899/00",
180
+ ["Barnsley St. Peter's FC, Barnsley", "eng"],
181
+ ["Barnsley FC", "eng"]],
182
+ ["MERGE",
183
+ "1899/00",
184
+ [["Blackpool FC, Blackpool", "eng"], ["South Shore FC, Blackpool", "eng"]],
185
+ ["Blackpool FC", "eng"]],
186
+ ["RENAME",
187
+ "1898/99",
188
+ ["Glossop North End FC, Glossop", "eng"],
189
+ ["Glossop FC", "eng"]],
190
+ ["RENAME",
191
+ "1895/96",
192
+ ["Walsall Town Swifts FC, Walsall", "eng"],
193
+ ["Walsall FC", "eng"]],
194
+ ["REFORM",
195
+ "1894/95",
196
+ ["Ardwick FC, Manchester", "eng"],
197
+ ["Manchester City FC", "eng"]],
198
+ ["BANKRUPT", "1893/94", ["Ardwick FC, Manchester", "eng"]],
199
+ ["MERGE",
200
+ "1893/94",
201
+ [["Newcastle West End FC, Newcastle-upon-Tyne", "eng"],
202
+ ["Newcastle East End FC, Newcastle-upon-Tyne", "eng"]],
203
+ ["Newcastle United FC", "eng"]],
204
+ ["RENAME",
205
+ "1892/93",
206
+ ["Royal Arsenal FC, London", "eng"],
207
+ ["Woolwich Arsenal FC", "eng"]]]
208
+
209
+ assert_equal exp, recs
210
+ end
211
+
212
+ end # class TestClubHistoryReader
@@ -1,89 +1,89 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_country_reader.rb
6
-
7
-
8
- require 'helper'
9
-
10
- class TestCountryReader < MiniTest::Test
11
-
12
- def test_read
13
- recs = SportDb::Import::CountryReader.read( "#{SportDb::Test.data_dir}/world/countries.txt" )
14
- pp recs
15
-
16
- assert_equal 232, recs.size
17
-
18
- assert_equal 'Albania', recs[0].name
19
- assert_equal 'ALB', recs[0].code
20
- assert_equal 'al', recs[0].key
21
- assert_equal ['fifa', 'uefa'], recs[0].tags
22
-
23
- assert_equal 'Andorra', recs[1].name
24
- assert_equal 'AND', recs[1].code
25
- assert_equal 'ad', recs[1].key
26
- assert_equal ['fifa', 'uefa'], recs[1].tags
27
- end
28
-
29
- def test_parse
30
- recs = SportDb::Import::CountryReader.parse( <<TXT )
31
- #####
32
- # FIFA countries and codes
33
-
34
- # Key Name, FIFA
35
-
36
- af Afghanistan, AFG, fifa › afc
37
- al Albania, ALB, fifa › uefa
38
- dz Algeria, ALG, fifa › caf
39
- as American Samoa › US, ASA,
40
- | Am. Samoa
41
- TXT
42
-
43
- pp recs
44
-
45
- assert_equal 4, recs.size
46
- assert_equal 'Afghanistan', recs[0].name
47
- assert_equal 'AFG', recs[0].code
48
- assert_equal 'af', recs[0].key
49
- assert_equal [], recs[0].alt_names
50
- assert_equal ['fifa', 'afc'], recs[0].tags
51
-
52
- assert_equal 'American Samoa', recs[3].name
53
- assert_equal 'ASA', recs[3].code
54
- assert_equal 'as', recs[3].key
55
- assert_equal ['Am. Samoa'], recs[3].alt_names
56
- assert_equal [], recs[3].tags
57
- end
58
-
59
- def test_parse_historic
60
- recs = SportDb::Import::CountryReader.parse( <<TXT )
61
- ###########################################
62
- # Former national teams
63
- # with former FIFA country codes etc.
64
- -1992 Czechoslovakia, TCH ⇒ Czech Republic
65
-
66
- -1991 Soviet Union, URS ⇒ Russia
67
-
68
- -1989 West Germany, FRG => Germany
69
- -1989 East Germany, GDR => Germany
70
- TXT
71
-
72
- pp recs
73
-
74
- assert_equal 4, recs.size
75
- assert_equal 'Czechoslovakia (-1992)', recs[0].name
76
- assert_equal 'TCH', recs[0].code
77
- assert_equal 'czechoslovakia', recs[0].key
78
- assert_equal [], recs[0].alt_names
79
- assert_equal [], recs[0].tags
80
-
81
- assert_equal 'East Germany (-1989)', recs[3].name
82
- assert_equal 'GDR', recs[3].code
83
- assert_equal 'eastgermany', recs[3].key
84
- assert_equal [], recs[3].alt_names
85
- assert_equal [], recs[3].tags
86
- end
87
-
88
-
89
- end # class TestCountryReader
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_country_reader.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+ class TestCountryReader < MiniTest::Test
11
+
12
+ def test_read
13
+ recs = SportDb::Import::CountryReader.read( "#{SportDb::Test.data_dir}/world/countries.txt" )
14
+ pp recs
15
+
16
+ assert_equal 232, recs.size
17
+
18
+ assert_equal 'Albania', recs[0].name
19
+ assert_equal 'ALB', recs[0].code
20
+ assert_equal 'al', recs[0].key
21
+ assert_equal ['fifa', 'uefa'], recs[0].tags
22
+
23
+ assert_equal 'Andorra', recs[1].name
24
+ assert_equal 'AND', recs[1].code
25
+ assert_equal 'ad', recs[1].key
26
+ assert_equal ['fifa', 'uefa'], recs[1].tags
27
+ end
28
+
29
+ def test_parse
30
+ recs = SportDb::Import::CountryReader.parse( <<TXT )
31
+ #####
32
+ # FIFA countries and codes
33
+
34
+ # Key Name, FIFA
35
+
36
+ af Afghanistan, AFG, fifa › afc
37
+ al Albania, ALB, fifa › uefa
38
+ dz Algeria, ALG, fifa › caf
39
+ as American Samoa › US, ASA,
40
+ | Am. Samoa
41
+ TXT
42
+
43
+ pp recs
44
+
45
+ assert_equal 4, recs.size
46
+ assert_equal 'Afghanistan', recs[0].name
47
+ assert_equal 'AFG', recs[0].code
48
+ assert_equal 'af', recs[0].key
49
+ assert_equal [], recs[0].alt_names
50
+ assert_equal ['fifa', 'afc'], recs[0].tags
51
+
52
+ assert_equal 'American Samoa', recs[3].name
53
+ assert_equal 'ASA', recs[3].code
54
+ assert_equal 'as', recs[3].key
55
+ assert_equal ['Am. Samoa'], recs[3].alt_names
56
+ assert_equal [], recs[3].tags
57
+ end
58
+
59
+ def test_parse_historic
60
+ recs = SportDb::Import::CountryReader.parse( <<TXT )
61
+ ###########################################
62
+ # Former national teams
63
+ # with former FIFA country codes etc.
64
+ -1992 Czechoslovakia, TCH ⇒ Czech Republic
65
+
66
+ -1991 Soviet Union, URS ⇒ Russia
67
+
68
+ -1989 West Germany, FRG => Germany
69
+ -1989 East Germany, GDR => Germany
70
+ TXT
71
+
72
+ pp recs
73
+
74
+ assert_equal 4, recs.size
75
+ assert_equal 'Czechoslovakia (-1992)', recs[0].name
76
+ assert_equal 'TCH', recs[0].code
77
+ assert_equal 'czechoslovakia', recs[0].key
78
+ assert_equal [], recs[0].alt_names
79
+ assert_equal [], recs[0].tags
80
+
81
+ assert_equal 'East Germany (-1989)', recs[3].name
82
+ assert_equal 'GDR', recs[3].code
83
+ assert_equal 'eastgermany', recs[3].key
84
+ assert_equal [], recs[3].alt_names
85
+ assert_equal [], recs[3].tags
86
+ end
87
+
88
+
89
+ end # class TestCountryReader