sportdb-formats 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +5 -0
- data/Rakefile +2 -2
- data/lib/sportdb/formats.rb +17 -5
- data/lib/sportdb/formats/country/country_index.rb +7 -7
- data/lib/sportdb/formats/country/country_reader.rb +26 -6
- data/lib/sportdb/formats/datafile_package.rb +10 -7
- data/lib/sportdb/formats/league/league_outline_reader.rb +24 -7
- data/lib/sportdb/formats/league/league_reader.rb +3 -3
- data/lib/sportdb/formats/match/mapper.rb +63 -63
- data/lib/sportdb/formats/match/mapper_teams.rb +1 -1
- data/lib/sportdb/formats/match/match_parser.rb +99 -180
- data/lib/sportdb/formats/match/match_parser_csv.rb +321 -0
- data/lib/sportdb/formats/package.rb +165 -11
- data/lib/sportdb/formats/parser_helper.rb +11 -2
- data/lib/sportdb/formats/score/score_formats.rb +41 -1
- data/lib/sportdb/formats/score/score_parser.rb +6 -0
- data/lib/sportdb/formats/structs/country.rb +6 -3
- data/lib/sportdb/formats/structs/group.rb +5 -12
- data/lib/sportdb/formats/structs/round.rb +6 -13
- data/lib/sportdb/formats/structs/standings.rb +30 -9
- data/lib/sportdb/formats/structs/team.rb +1 -2
- data/lib/sportdb/formats/team/club_reader_props.rb +3 -3
- data/lib/sportdb/formats/version.rb +4 -2
- data/test/helper.rb +2 -1
- data/test/test_club_reader_props.rb +2 -2
- data/test/test_country_index.rb +4 -4
- data/test/test_country_reader.rb +34 -4
- data/test/test_csv_match_parser.rb +114 -0
- data/test/test_csv_match_parser_utils.rb +20 -0
- data/test/test_csv_reader.rb +5 -5
- data/test/test_datafile.rb +0 -32
- data/test/test_datafile_package.rb +46 -0
- data/test/test_match_auto_relegation.rb +41 -0
- data/test/test_package.rb +60 -28
- data/test/test_package_match.rb +27 -3
- data/test/test_regex.rb +25 -7
- data/test/test_scores.rb +58 -49
- metadata +9 -4
@@ -11,10 +11,9 @@ class Team
|
|
11
11
|
## todo: use just names for alt_names - why? why not?
|
12
12
|
attr_accessor :key, :name, :alt_names,
|
13
13
|
:code, ## code == abbreviation e.g. ARS etc.
|
14
|
-
:year, :year_end, ## todo/fix: change year_end to end_year (like in season)!!!
|
14
|
+
:year, :year_end, ## todo/fix: change year to start_year and year_end to end_year (like in season)!!!
|
15
15
|
:country
|
16
16
|
|
17
|
-
alias_method :title, :name ## add alias/compat - why? why not
|
18
17
|
|
19
18
|
def names
|
20
19
|
## todo/check: add alt_names_auto too? - why? why not?
|
@@ -27,7 +27,7 @@ class ClubPropsReader
|
|
27
27
|
def parse
|
28
28
|
recs = parse_csv( @txt )
|
29
29
|
recs.each do |rec|
|
30
|
-
name = rec[
|
30
|
+
name = rec['Name']
|
31
31
|
if name.nil?
|
32
32
|
puts "** !!! ERROR !!! Name column required / missing / NOT found in row:"
|
33
33
|
pp rec
|
@@ -62,8 +62,8 @@ class ClubPropsReader
|
|
62
62
|
## todo/fix: only updated "on-demand" from in-memory struct/records!!!!
|
63
63
|
|
64
64
|
## update attributes
|
65
|
-
club_rec.key = rec[
|
66
|
-
club_rec.code = rec[
|
65
|
+
club_rec.key = rec['Key'] if rec['Key']
|
66
|
+
club_rec.code = rec['Code'] if rec['Code']
|
67
67
|
## todo/fix: add (some) more props e.g. address, web, etc.
|
68
68
|
end
|
69
69
|
end
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
module SportDb
|
5
|
+
module Module
|
5
6
|
module Formats
|
6
7
|
|
7
8
|
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
8
|
-
MINOR =
|
9
|
-
PATCH =
|
9
|
+
MINOR = 1
|
10
|
+
PATCH = 0
|
10
11
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
12
|
|
12
13
|
def self.version
|
@@ -22,4 +23,5 @@ module Formats
|
|
22
23
|
end
|
23
24
|
|
24
25
|
end # module Formats
|
26
|
+
end # module Module
|
25
27
|
end # module SportDb
|
data/test/helper.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
## note: use the local version of gems
|
2
2
|
$LOAD_PATH.unshift( File.expand_path( '../date-formats/lib' ))
|
3
|
+
$LOAD_PATH.unshift( File.expand_path( '../sportdb-langs/lib' ))
|
3
4
|
|
4
5
|
|
5
6
|
## minitest setup
|
@@ -147,7 +148,7 @@ def parse_json( str )
|
|
147
148
|
end
|
148
149
|
|
149
150
|
def read_test( path )
|
150
|
-
blocks = read_blocks( "
|
151
|
+
blocks = read_blocks( "#{SportDb::Test.data_dir}/football.txt/#{path}" )
|
151
152
|
|
152
153
|
if blocks.size == 2
|
153
154
|
[blocks[0], parse_json( blocks[1] )]
|
@@ -29,8 +29,8 @@ TXT
|
|
29
29
|
recs = parse_csv( ENG_CLUBS_PROPS_TXT )
|
30
30
|
pp recs
|
31
31
|
|
32
|
-
assert_equal [{
|
33
|
-
{
|
32
|
+
assert_equal [{ 'Key' => 'chelsea', 'Name' => 'Chelsea FC', 'Code' => 'CHE' },
|
33
|
+
{ 'Key' => 'arsenal', 'Name' => 'Arsenal FC', 'Code' => 'ARS' }], recs[0..1]
|
34
34
|
end
|
35
35
|
|
36
36
|
CLUBS = SportDb::Import.catalog.clubs
|
data/test/test_country_index.rb
CHANGED
@@ -16,12 +16,12 @@ class TestCountryIndex < MiniTest::Test
|
|
16
16
|
eng = countries[:eng]
|
17
17
|
assert_equal 'eng', eng.key
|
18
18
|
assert_equal 'England', eng.name
|
19
|
-
assert_equal 'ENG', eng.
|
19
|
+
assert_equal 'ENG', eng.code
|
20
20
|
|
21
21
|
at = countries[:at]
|
22
22
|
assert_equal 'at', at.key
|
23
23
|
assert_equal 'Austria', at.name
|
24
|
-
assert_equal 'AUT', at.
|
24
|
+
assert_equal 'AUT', at.code
|
25
25
|
assert_equal ['Österreich [de]'], at.alt_names
|
26
26
|
|
27
27
|
assert at == countries['AT']
|
@@ -48,13 +48,13 @@ class TestCountryIndex < MiniTest::Test
|
|
48
48
|
assert at == countries.parse( 'Österreich • Austria' )
|
49
49
|
assert at == countries.parse( 'Austria' )
|
50
50
|
assert at == countries.parse( 'at' ) ## (iso alpha2) country code
|
51
|
-
assert at == countries.parse( 'AUT' ) ## fifa code
|
51
|
+
assert at == countries.parse( 'AUT' ) ## (fifa) country code
|
52
52
|
|
53
53
|
|
54
54
|
de = countries[:de]
|
55
55
|
assert_equal 'de', de.key
|
56
56
|
assert_equal 'Germany', de.name
|
57
|
-
assert_equal 'GER', de.
|
57
|
+
assert_equal 'GER', de.code
|
58
58
|
assert_equal ['Deutschland [de]'], de.alt_names
|
59
59
|
|
60
60
|
assert de == countries.parse( 'Deutschland (de) • Germany' )
|
data/test/test_country_reader.rb
CHANGED
@@ -16,12 +16,12 @@ class TestCountryReader < MiniTest::Test
|
|
16
16
|
assert_equal 232, recs.size
|
17
17
|
|
18
18
|
assert_equal 'Albania', recs[0].name
|
19
|
-
assert_equal 'ALB', recs[0].
|
19
|
+
assert_equal 'ALB', recs[0].code
|
20
20
|
assert_equal 'al', recs[0].key
|
21
21
|
assert_equal ['fifa', 'uefa'], recs[0].tags
|
22
22
|
|
23
23
|
assert_equal 'Andorra', recs[1].name
|
24
|
-
assert_equal 'AND', recs[1].
|
24
|
+
assert_equal 'AND', recs[1].code
|
25
25
|
assert_equal 'ad', recs[1].key
|
26
26
|
assert_equal ['fifa', 'uefa'], recs[1].tags
|
27
27
|
end
|
@@ -44,16 +44,46 @@ TXT
|
|
44
44
|
|
45
45
|
assert_equal 4, recs.size
|
46
46
|
assert_equal 'Afghanistan', recs[0].name
|
47
|
-
assert_equal 'AFG', recs[0].
|
47
|
+
assert_equal 'AFG', recs[0].code
|
48
48
|
assert_equal 'af', recs[0].key
|
49
49
|
assert_equal [], recs[0].alt_names
|
50
50
|
assert_equal ['fifa', 'afc'], recs[0].tags
|
51
51
|
|
52
52
|
assert_equal 'American Samoa', recs[3].name
|
53
|
-
assert_equal 'ASA', recs[3].
|
53
|
+
assert_equal 'ASA', recs[3].code
|
54
54
|
assert_equal 'as', recs[3].key
|
55
55
|
assert_equal ['Am. Samoa'], recs[3].alt_names
|
56
56
|
assert_equal [], recs[3].tags
|
57
57
|
end
|
58
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
|
+
|
59
89
|
end # class TestCountryReader
|
@@ -0,0 +1,114 @@
|
|
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_csv_match_parser_utils.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestCsvMatchParserUtils < MiniTest::Test
|
11
|
+
|
12
|
+
def test_find_seasons
|
13
|
+
pp = SportDb::CsvMatchParser.find_seasons( "#{SportDb::Test.data_dir}/dl/AUT.csv" ) ## defaults to col: 'Season', col_sep: ','
|
14
|
+
pp = SportDb::CsvMatchParser.find_seasons( "#{SportDb::Test.data_dir}/dl/Bundesliga_1963_2014.csv", col: 'Saison', sep: ';' )
|
15
|
+
assert true
|
16
|
+
end
|
17
|
+
|
18
|
+
end # class TestCsvMatchParserUtils
|
19
|
+
|
20
|
+
|
data/test/test_csv_reader.rb
CHANGED
@@ -13,7 +13,7 @@ class TestCsvReader < MiniTest::Test
|
|
13
13
|
recs = parse_csv( <<TXT )
|
14
14
|
### World Countries
|
15
15
|
|
16
|
-
|
16
|
+
Key, Code, Name
|
17
17
|
af, AFG, Afghanistan
|
18
18
|
al, ALB, Albania
|
19
19
|
dz, ALG, Algeria
|
@@ -21,10 +21,10 @@ as, ASA, American Samoa (US)
|
|
21
21
|
TXT
|
22
22
|
|
23
23
|
pp recs
|
24
|
-
assert_equal [{
|
25
|
-
{
|
26
|
-
{
|
27
|
-
{
|
24
|
+
assert_equal [{ 'Key' => 'af', 'Code' => 'AFG', 'Name' => 'Afghanistan'},
|
25
|
+
{ 'Key' => 'al', 'Code' => 'ALB', 'Name' => 'Albania'},
|
26
|
+
{ 'Key' => 'dz', 'Code' => 'ALG', 'Name' => 'Algeria'},
|
27
|
+
{ 'Key' => 'as', 'Code' => 'ASA', 'Name' => 'American Samoa (US)'},
|
28
28
|
], recs[0..3]
|
29
29
|
end
|
30
30
|
|
data/test/test_datafile.rb
CHANGED
@@ -27,36 +27,4 @@ class TestDatafile < MiniTest::Test
|
|
27
27
|
assert Datafile::Package.match_exclude?( '/.build/leagues.txt' )
|
28
28
|
assert Datafile::Package.match_exclude?( '/.git/leagues.txt' )
|
29
29
|
end
|
30
|
-
|
31
|
-
|
32
|
-
CLUBS_DIR = '../../../openfootball/clubs' ## source repo directory path
|
33
|
-
LEAGUES_DIR = '../../../openfootball/leagues'
|
34
|
-
|
35
|
-
def test_bundle
|
36
|
-
datafiles = SportDb::Package.find_clubs( CLUBS_DIR )
|
37
|
-
pp datafiles
|
38
|
-
|
39
|
-
## todo/fix: turn into Datafile::Bundle.new and Bundle#write/save -why? why not?
|
40
|
-
bundle = Datafile::Bundle.new( './tmp/clubs.txt' )
|
41
|
-
bundle.write <<TXT
|
42
|
-
##########################################
|
43
|
-
# auto-generated all-in-one single datafile clubs.txt bundle
|
44
|
-
# on #{Time.now} from #{datafiles.size} datafile(s)
|
45
|
-
TXT
|
46
|
-
bundle.write datafiles
|
47
|
-
bundle.close
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_bundle_old
|
51
|
-
datafiles = SportDb::Package.find_leagues( LEAGUES_DIR )
|
52
|
-
pp datafiles
|
53
|
-
|
54
|
-
Datafile.write_bundle( './tmp/leagues.txt',
|
55
|
-
datafiles: datafiles,
|
56
|
-
header: <<TXT )
|
57
|
-
##########################################
|
58
|
-
# auto-generated all-in-one single datafile leagues.txt bundle
|
59
|
-
# on #{Time.now} from #{datafiles.size} datafile(s)
|
60
|
-
TXT
|
61
|
-
end
|
62
30
|
end # class TestDatafile
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_datafile_package.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
|
11
|
+
class TestDatafilePackage < MiniTest::Test
|
12
|
+
|
13
|
+
def test_read
|
14
|
+
[Datafile::DirPackage.new( '../../../openfootball/england' ),
|
15
|
+
Datafile::ZipPackage.new( 'tmp/england-master.zip' )
|
16
|
+
].each do |eng|
|
17
|
+
assert eng.find( '2015-16/.conf.txt' ).read.start_with?( '= English Premier League 2015/16' )
|
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' )
|
20
|
+
end
|
21
|
+
|
22
|
+
[Datafile::DirPackage.new( '../../../openfootball/austria' ),
|
23
|
+
Datafile::ZipPackage.new( 'tmp/austria-master.zip' )
|
24
|
+
].each do |at|
|
25
|
+
assert at.find( '2018-19/.conf.txt' ).read.start_with?( '= Österr. Bundesliga 2018/19' )
|
26
|
+
end
|
27
|
+
|
28
|
+
puts "DirPackage:"
|
29
|
+
pack = Datafile::DirPackage.new( '../../../openfootball/austria' )
|
30
|
+
puts pack.name
|
31
|
+
puts " entries:"
|
32
|
+
pack.each( pattern: /\.txt$/ ) do |entry|
|
33
|
+
puts entry.name
|
34
|
+
end
|
35
|
+
|
36
|
+
puts "ZipPackage:"
|
37
|
+
pack = Datafile::ZipPackage.new( 'tmp/austria-master.zip' )
|
38
|
+
puts pack.name
|
39
|
+
puts " entries:"
|
40
|
+
pack.each( pattern: /\.txt$/ ) do |entry|
|
41
|
+
puts entry.name
|
42
|
+
end
|
43
|
+
|
44
|
+
end # method test_read
|
45
|
+
|
46
|
+
end # class TestDatafilePackage
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_match_auto_relegation.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
|
11
|
+
class TestMatchAutoRelegation < MiniTest::Test
|
12
|
+
|
13
|
+
def test_rel
|
14
|
+
txt = <<TXT
|
15
|
+
Hinspiel
|
16
|
+
[31.5.]
|
17
|
+
SC Wiener Neustadt 0-2 SKN St. Pölten
|
18
|
+
|
19
|
+
Rückspiel
|
20
|
+
[3.6.]
|
21
|
+
SKN St. Pölten 1-1 SC Wiener Neustadt
|
22
|
+
TXT
|
23
|
+
|
24
|
+
start = Date.new( 2017, 7, 1 )
|
25
|
+
SportDb::Import.config.lang = 'de'
|
26
|
+
|
27
|
+
teams, rounds, groups, round_defs, group_defs = SportDb::AutoConfParser.parse( txt, start: start )
|
28
|
+
|
29
|
+
puts "teams:"
|
30
|
+
pp teams
|
31
|
+
puts "rounds:"
|
32
|
+
pp rounds
|
33
|
+
puts "groups:"
|
34
|
+
pp groups
|
35
|
+
puts "round defs:"
|
36
|
+
pp round_defs
|
37
|
+
puts "group defs:"
|
38
|
+
pp group_defs
|
39
|
+
end
|
40
|
+
|
41
|
+
end # class TestMatchAutoRelegation
|