sportdb-formats 1.1.2 → 1.1.3

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +6 -13
  3. data/Rakefile +1 -1
  4. data/lib/sportdb/formats.rb +5 -0
  5. data/lib/sportdb/formats/country/country_index.rb +2 -2
  6. data/lib/sportdb/formats/event/event_index.rb +9 -11
  7. data/lib/sportdb/formats/league/league_index.rb +22 -18
  8. data/lib/sportdb/formats/league/league_outline_reader.rb +4 -1
  9. data/lib/sportdb/formats/league/league_reader.rb +7 -1
  10. data/lib/sportdb/formats/match/match_parser.rb +27 -15
  11. data/lib/sportdb/formats/match/match_parser_csv.rb +148 -21
  12. data/lib/sportdb/formats/match/match_status_parser.rb +86 -0
  13. data/lib/sportdb/formats/name_helper.rb +4 -1
  14. data/lib/sportdb/formats/package.rb +30 -8
  15. data/lib/sportdb/formats/score/score_formats.rb +19 -0
  16. data/lib/sportdb/formats/score/score_parser.rb +4 -2
  17. data/lib/sportdb/formats/structs/match.rb +2 -0
  18. data/lib/sportdb/formats/structs/team.rb +7 -0
  19. data/lib/sportdb/formats/team/club_index.rb +13 -11
  20. data/lib/sportdb/formats/team/club_index_history.rb +138 -0
  21. data/lib/sportdb/formats/team/club_reader_history.rb +203 -0
  22. data/lib/sportdb/formats/team/club_reader_props.rb +2 -3
  23. data/lib/sportdb/formats/version.rb +1 -1
  24. data/test/helper.rb +47 -81
  25. data/test/test_club_index_history.rb +107 -0
  26. data/test/test_club_reader_history.rb +212 -0
  27. data/test/test_datafile_package.rb +1 -1
  28. data/test/test_match_status_parser.rb +49 -0
  29. data/test/test_scores.rb +2 -0
  30. metadata +10 -17
  31. data/test/test_conf.rb +0 -65
  32. data/test/test_csv_match_parser.rb +0 -114
  33. data/test/test_csv_match_parser_utils.rb +0 -20
  34. data/test/test_match_auto.rb +0 -72
  35. data/test/test_match_auto_champs.rb +0 -45
  36. data/test/test_match_auto_euro.rb +0 -37
  37. data/test/test_match_auto_relegation.rb +0 -41
  38. data/test/test_match_auto_worldcup.rb +0 -61
  39. data/test/test_match_champs.rb +0 -27
  40. data/test/test_match_eng.rb +0 -26
  41. data/test/test_match_euro.rb +0 -27
  42. data/test/test_match_start_date.rb +0 -44
  43. data/test/test_match_worldcup.rb +0 -27
@@ -0,0 +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
@@ -16,7 +16,7 @@ class TestDatafilePackage < MiniTest::Test
16
16
  ].each do |eng|
17
17
  assert eng.find( '2015-16/.conf.txt' ).read.start_with?( '= English Premier League 2015/16' )
18
18
  assert eng.find( '2017-18/.conf.txt' ).read.start_with?( '= English Premier League 2017/18' )
19
- assert eng.find( '2015-16/1-premierleague-i.txt' ).read.start_with?( '= English Premier League 2015/16' )
19
+ assert eng.find( '2015-16/1-premierleague.txt' ).read.start_with?( '= English Premier League 2015/16' )
20
20
  end
21
21
 
22
22
  [Datafile::DirPackage.new( '../../../openfootball/austria' ),
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_match_status_parser.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestMatchStatusParser < MiniTest::Test
12
+
13
+ Status = SportDb::Status
14
+ StatusParser = SportDb::StatusParser
15
+
16
+ def test_find
17
+ [['awarded [cancelled] canceled [ddd]', Status::CANCELLED],
18
+ ['awarded [bbb; canceled] canceled [awarded; comments] eeee', Status::AWARDED],
19
+ ['aaa bbb ccc ddd eeee', nil],
20
+ ].each do |rec|
21
+ line = rec[0]
22
+ status_exp = rec[1]
23
+ puts "line (before): >#{line}<"
24
+ status = StatusParser.find!( line )
25
+ puts "status: >#{status}<"
26
+ puts "line (after): >#{line}<"
27
+ puts
28
+
29
+ assert_equal status_exp, status
30
+ end
31
+ end # method test_find
32
+
33
+ def test_parse
34
+ [['cancelled ddd', Status::CANCELLED],
35
+ ['CANCELLED', Status::CANCELLED],
36
+ ['can.', Status::CANCELLED],
37
+ ['awarded; comments', Status::AWARDED],
38
+ ['awd. - comments', Status::AWARDED],
39
+ ['aaa bbb ccc ddd eeee', nil],
40
+ ].each do |rec|
41
+ str = rec[0]
42
+ status_exp = rec[1]
43
+ assert_equal status_exp, StatusParser.parse( str )
44
+ end
45
+ end
46
+
47
+ end # class TestMatchStatusParser
48
+
49
+
@@ -80,12 +80,14 @@ class TestScores < MiniTest::Test
80
80
  [ '2-1aet (1-1, 0-0)', [0,0, 1,1, 2,1]],
81
81
  [ '2-1 A.E.T. (1-1, 0-0)', [0,0, 1,1, 2,1]],
82
82
  [ '2-1AET (1-1, 0-0)', [0,0, 1,1, 2,1]],
83
+ [ '2-1 a.e.t.', [nil,nil,nil,nil, 2,1]],
83
84
 
84
85
  [ '3-4 pen. 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
85
86
  [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
86
87
  [ '3-4 pen 2-2 a.e.t. (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
87
88
  [ '3-4p 2-2aet (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
88
89
  [ '3-4PSO 2-2AET (1-1, 1-1)', [1,1, 1,1, 2,2, 3,4]],
90
+ [ '3-4 pen. 2-2 a.e.t.', [nil,nil,nil,nil, 2,2, 3,4]],
89
91
 
90
92
  [ '4-3 pen. 1-0 a.e.t. (1-0, )', [nil,nil, 1,0, 1,0, 4,3]],
91
93
  [ '3-4 pen. 2-1 a.e.t. (2-1, )', [nil,nil, 2,1, 2,1, 3,4]],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-formats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-07 00:00:00.000000000 Z
11
+ date: 2020-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alphabets
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.0
61
+ version: 0.1.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.0
68
+ version: 0.1.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubyzip
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +139,7 @@ files:
139
139
  - lib/sportdb/formats/match/match_parser.rb
140
140
  - lib/sportdb/formats/match/match_parser_auto_conf.rb
141
141
  - lib/sportdb/formats/match/match_parser_csv.rb
142
+ - lib/sportdb/formats/match/match_status_parser.rb
142
143
  - lib/sportdb/formats/name_helper.rb
143
144
  - lib/sportdb/formats/outline_reader.rb
144
145
  - lib/sportdb/formats/package.rb
@@ -157,7 +158,9 @@ files:
157
158
  - lib/sportdb/formats/structs/team.rb
158
159
  - lib/sportdb/formats/structs/team_usage.rb
159
160
  - lib/sportdb/formats/team/club_index.rb
161
+ - lib/sportdb/formats/team/club_index_history.rb
160
162
  - lib/sportdb/formats/team/club_reader.rb
163
+ - lib/sportdb/formats/team/club_reader_history.rb
161
164
  - lib/sportdb/formats/team/club_reader_props.rb
162
165
  - lib/sportdb/formats/team/national_team_index.rb
163
166
  - lib/sportdb/formats/team/team_index.rb
@@ -165,14 +168,13 @@ files:
165
168
  - lib/sportdb/formats/version.rb
166
169
  - test/helper.rb
167
170
  - test/test_club_index.rb
171
+ - test/test_club_index_history.rb
168
172
  - test/test_club_reader.rb
173
+ - test/test_club_reader_history.rb
169
174
  - test/test_club_reader_props.rb
170
175
  - test/test_clubs.rb
171
- - test/test_conf.rb
172
176
  - test/test_country_index.rb
173
177
  - test/test_country_reader.rb
174
- - test/test_csv_match_parser.rb
175
- - test/test_csv_match_parser_utils.rb
176
178
  - test/test_csv_reader.rb
177
179
  - test/test_datafile.rb
178
180
  - test/test_datafile_package.rb
@@ -181,16 +183,7 @@ files:
181
183
  - test/test_league_outline_reader.rb
182
184
  - test/test_league_reader.rb
183
185
  - test/test_match.rb
184
- - test/test_match_auto.rb
185
- - test/test_match_auto_champs.rb
186
- - test/test_match_auto_euro.rb
187
- - test/test_match_auto_relegation.rb
188
- - test/test_match_auto_worldcup.rb
189
- - test/test_match_champs.rb
190
- - test/test_match_eng.rb
191
- - test/test_match_euro.rb
192
- - test/test_match_start_date.rb
193
- - test/test_match_worldcup.rb
186
+ - test/test_match_status_parser.rb
194
187
  - test/test_name_helper.rb
195
188
  - test/test_outline_reader.rb
196
189
  - test/test_package.rb
@@ -1,65 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_conf.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestConf < MiniTest::Test
12
-
13
- COUNTRY_RE = SportDb::ConfParser::COUNTRY_RE
14
- TABLE_RE = SportDb::ConfParser::TABLE_RE
15
-
16
- def test_re
17
- m=COUNTRY_RE.match( 'Manchester United › ENG' )
18
- pp m
19
- pp m[0]
20
- assert_equal 'ENG', m[:country]
21
-
22
- m=COUNTRY_RE.match( 'Manchester United›ENG' )
23
- pp m
24
- pp m[0]
25
- assert_equal 'ENG', m[:country]
26
-
27
-
28
- m=TABLE_RE.match( '1 Manchester City 38 32 4 2 106-27 100' )
29
- pp m
30
- assert_equal 'Manchester City', m[:team]
31
-
32
- m=TABLE_RE.match( '1. Manchester City 38 32 4 2 106:27 100' )
33
- pp m
34
- assert_equal 'Manchester City', m[:team]
35
-
36
- m=TABLE_RE.match( '- Manchester City 38 32 4 2 106 - 27 100' )
37
- pp m
38
- assert_equal 'Manchester City', m[:team]
39
-
40
-
41
- m=TABLE_RE.match( '1. 1. FC Mainz 38 32 4 2 106-27 100 [-7]' )
42
- pp m
43
- assert_equal '1. FC Mainz', m[:team]
44
- end
45
-
46
-
47
- def test_conf
48
- %w[conf/at_cup.txt
49
- conf/at_reg.txt
50
- conf/at_champs.txt
51
- conf/eng.txt
52
- conf/champs.txt
53
- ].each do |path|
54
- txt, exp = read_test( path )
55
-
56
- puts "testing conf #{path}..."
57
- teams = parse_conf( txt )
58
-
59
- ## note: json always returns hash tables with string keys (not symbols),
60
- ## thus, always stringify keys before comparing!!!!
61
- assert_equal exp, teams.deep_stringify_keys
62
- end
63
- end
64
-
65
- end # class TestConf
@@ -1,114 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_csv_match_parser.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestCsvMatchParser < MiniTest::Test
12
-
13
- ##
14
- # Div,Date,HomeTeam,AwayTeam,FTHG,FTAG,FTR,HTHG,HTAG,HTR,
15
- # Referee,HS,AS,HST,AST,HF,AF,HC,AC,HY,AY,HR,AR,
16
- # B365H,B365D,B365A,BWH,BWD,BWA,IWH,IWD,IWA,LBH,LBD,LBA,PSH,PSD,PSA,
17
- # WHH,WHD,WHA,VCH,VCD,VCA,
18
- # Bb1X2,BbMxH,BbAvH,BbMxD,BbAvD,BbMxA,BbAvA,BbOU,BbMx>2.5,BbAv>2.5,BbMx<2.5,BbAv<2.5,
19
- # BbAH,BbAHh,BbMxAHH,BbAvAHH,BbMxAHA,BbAvAHA,PSCH,PSCD,PSCA
20
- def test_eng_filters
21
- path = "#{SportDb::Test.data_dir}/england/2017-18/E0.csv"
22
-
23
- matches = SportDb::CsvMatchParser.read( path,
24
- filters: { 'HomeTeam' => 'Arsenal' } )
25
-
26
- pp path
27
- pp matches[0..2]
28
-
29
- m=matches[0]
30
- assert_equal '2017-08-11', m.date
31
- assert_equal 4, m.score1
32
- assert_equal 3, m.score2
33
- assert_equal 2, m.score1i
34
- assert_equal 2, m.score2i
35
- assert_equal 'Arsenal', m.team1
36
- assert_equal 'Leicester', m.team2
37
-
38
- m=matches[1]
39
- assert_equal '2017-09-09', m.date
40
- assert_equal 3, m.score1
41
- assert_equal 0, m.score2
42
- assert_equal 2, m.score1i
43
- assert_equal 0, m.score2i
44
- assert_equal 'Arsenal', m.team1
45
- assert_equal 'Bournemouth', m.team2
46
- end
47
-
48
-
49
- def test_eng_headers
50
- path = "#{SportDb::Test.data_dir}/england/2017-18/E0.csv"
51
-
52
- headers = { team1: 'HomeTeam',
53
- team2: 'AwayTeam',
54
- date: 'Date',
55
- score1: 'FTHG',
56
- score2: 'FTAG' }
57
-
58
- matches = SportDb::CsvMatchParser.read( path, headers: headers )
59
-
60
- pp path
61
- pp matches[0..2]
62
-
63
- m=matches[0]
64
- assert_equal '2017-08-11', m.date
65
- assert_equal 4, m.score1
66
- assert_equal 3, m.score2
67
- assert_nil m.score1i ## todo/fix: missing half time (ht) score !!!!
68
- assert_nil m.score2i ## todo/fix: missing half time (ht) score !!!!
69
- assert_equal 'Arsenal', m.team1
70
- assert_equal 'Leicester', m.team2
71
-
72
- m=matches[1]
73
- assert_equal '2017-08-12', m.date
74
- assert_equal 0, m.score1
75
- assert_equal 2, m.score2
76
- assert_nil m.score1i ## todo/fix: missing half time (ht) score !!!!
77
- assert_nil m.score2i ## todo/fix: missing half time (ht) score !!!!
78
- assert_equal 'Brighton', m.team1
79
- assert_equal 'Man City', m.team2
80
- end
81
-
82
-
83
- ###
84
- # Country,League,Season,Date,Time,Home,Away,HG,AG,
85
- # Res,PH,PD,PA,MaxH,MaxD,MaxA,AvgH,AvgD,AvgA
86
- def test_at
87
- path = "#{SportDb::Test.data_dir}/austria/AUT.csv"
88
-
89
- matches = SportDb::CsvMatchParser.read( path, filters: { 'Season' => '2017/2018' } )
90
-
91
- pp matches[0..2]
92
- pp path
93
-
94
- m=matches[0]
95
- assert_equal '2017-07-22', m.date
96
- assert_equal 2, m.score1
97
- assert_equal 2, m.score2
98
- assert_nil m.score1i ## todo/fix: missing half time (ht) score !!!!
99
- assert_nil m.score2i ## todo/fix: missing half time (ht) score !!!!
100
- assert_equal 'Rapid Vienna', m.team1
101
- assert_equal 'Mattersburg', m.team2
102
-
103
- m=matches[1]
104
- assert_equal '2017-07-22', m.date
105
- assert_equal 0, m.score1
106
- assert_equal 2, m.score2
107
- assert_nil m.score1i ## todo/fix: missing half time (ht) score !!!!
108
- assert_nil m.score2i ## todo/fix: missing half time (ht) score !!!!
109
- assert_equal 'AC Wolfsberger', m.team1
110
- assert_equal 'Salzburg', m.team2
111
- end
112
-
113
-
114
- end # class TestCsvMatchParser