sportdb-config 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/leagues/fr.txt +9 -9
- data/config/leagues/gr.txt +7 -7
- data/config/leagues/sco.txt +19 -19
- data/config/world/eng.txt +162 -162
- data/lib/sportdb/config/club_reader.rb +278 -278
- data/lib/sportdb/config/clubs.rb +54 -27
- data/lib/sportdb/config/config.rb +123 -123
- data/lib/sportdb/config/league.rb +118 -118
- data/lib/sportdb/config/league_reader.rb +65 -65
- data/lib/sportdb/config/league_utils.rb +24 -24
- data/lib/sportdb/config/variants.rb +106 -91
- data/lib/sportdb/config/version.rb +2 -2
- data/test/test_club_index.rb +6 -0
- data/test/test_club_reader.rb +150 -150
- data/test/test_clubs.rb +14 -1
- data/test/test_league_reader.rb +54 -54
- data/test/test_league_utils.rb +46 -46
- data/test/test_season_utils.rb +29 -29
- metadata +6 -12
data/test/test_club_reader.rb
CHANGED
@@ -1,150 +1,150 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_club_reader.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestClubReader < MiniTest::Test
|
11
|
-
|
12
|
-
def test_parse_at
|
13
|
-
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
14
|
-
==================================
|
15
|
-
= Austria (at)
|
16
|
-
|
17
|
-
FK Austria Wien, Wien
|
18
|
-
| Austria Vienna | Austria Wien
|
19
|
-
SK Rapid Wien, Wien
|
20
|
-
| Rapid Vienna | Rapid Wien
|
21
|
-
Wiener Sport-Club, Wien
|
22
|
-
TXT
|
23
|
-
|
24
|
-
pp recs
|
25
|
-
|
26
|
-
assert_equal 3, recs.size
|
27
|
-
assert_equal 'FK Austria Wien', recs[0].name
|
28
|
-
assert_equal 'Wien', recs[0].city
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_parse_us
|
32
|
-
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
33
|
-
==================================================
|
34
|
-
= United States (us)
|
35
|
-
|
36
|
-
#######################################
|
37
|
-
# Major League Soccer (MLS) teams
|
38
|
-
|
39
|
-
Atlanta United FC, 2017, Atlanta › Georgia
|
40
|
-
| Atlanta United
|
41
|
-
Chicago Fire, 1998, Bridgeview › Illinois
|
42
|
-
FC Dallas, 1996, Frisco › Texas ## note: FC Dallas named >Dallas Burn< from 1996-2004
|
43
|
-
|
44
|
-
##################################
|
45
|
-
# Defunct / Historic
|
46
|
-
Miami Fusion (1998-2001), Fort Lauderdale › Florida
|
47
|
-
CD Chivas USA (2005-2014), Carson › California
|
48
|
-
| Chivas USA
|
49
|
-
TXT
|
50
|
-
|
51
|
-
pp recs
|
52
|
-
|
53
|
-
assert_equal 5, recs.size
|
54
|
-
assert_equal 'Atlanta United FC', recs[0].name
|
55
|
-
assert_equal 2017, recs[0].year
|
56
|
-
assert_equal 'Atlanta', recs[0].city
|
57
|
-
assert_equal ['Georgia'], recs[0].geos
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
def test_parse_years
|
62
|
-
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
63
|
-
= United States (us)
|
64
|
-
FC Dallas (1996-), Frisco › Texas
|
65
|
-
Miami Fusion (1998-2001), Fort Lauderdale › Florida
|
66
|
-
CD Chivas USA (-2014), Carson › California
|
67
|
-
TXT
|
68
|
-
|
69
|
-
pp recs
|
70
|
-
|
71
|
-
assert_equal 3, recs.size
|
72
|
-
assert_equal 1996, recs[0].year
|
73
|
-
assert_equal false, recs[0].historic?
|
74
|
-
assert_equal false, recs[0].past?
|
75
|
-
|
76
|
-
assert_equal 1998, recs[1].year
|
77
|
-
assert_equal 2001, recs[1].year_end
|
78
|
-
assert_equal true, recs[1].historic?
|
79
|
-
assert_equal true, recs[1].past?
|
80
|
-
|
81
|
-
assert_equal 2014, recs[2].year_end
|
82
|
-
assert_equal true, recs[2].historic?
|
83
|
-
assert_equal true, recs[2].past?
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_parse_geos
|
87
|
-
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
88
|
-
= England (eng)
|
89
|
-
== Greater London
|
90
|
-
|
91
|
-
Fulham FC, 1879, @ Craven Cottage, London (Fulham) › Greater London
|
92
|
-
| Fulham | FC Fulham
|
93
|
-
Charlton Athletic FC, @ The Valley, London (Charlton) › Greater London
|
94
|
-
| Charlton | Charlton Athletic
|
95
|
-
|
96
|
-
= Deutschland (de)
|
97
|
-
== Hamburg
|
98
|
-
|
99
|
-
St. Pauli, Hamburg (St. Pauli)
|
100
|
-
TXT
|
101
|
-
|
102
|
-
pp recs
|
103
|
-
|
104
|
-
assert_equal 3, recs.size
|
105
|
-
assert_equal 'London', recs[0].city
|
106
|
-
assert_equal 'Fulham', recs[0].district
|
107
|
-
assert_equal ['Greater London'], recs[0].geos
|
108
|
-
assert_equal 'England', recs[0].country.name
|
109
|
-
assert_equal 'eng', recs[0].country.key
|
110
|
-
|
111
|
-
assert_equal 'London', recs[1].city
|
112
|
-
assert_equal 'Charlton', recs[1].district
|
113
|
-
assert_equal ['Greater London'], recs[1].geos
|
114
|
-
assert_equal 'England', recs[1].country.name
|
115
|
-
assert_equal 'eng', recs[1].country.key
|
116
|
-
|
117
|
-
assert_equal 'Hamburg', recs[2].city
|
118
|
-
assert_equal 'St. Pauli', recs[2].district
|
119
|
-
assert_equal ['Hamburg'], recs[2].geos
|
120
|
-
assert_equal 'Germany', recs[2].country.name
|
121
|
-
assert_equal 'de', recs[2].country.key
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
def test_parse_headings
|
126
|
-
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
127
|
-
==============
|
128
|
-
====
|
129
|
-
===========
|
130
|
-
= Heading 1 - Austria (at)
|
131
|
-
= Heading 1 - Austria (at) ==================
|
132
|
-
== Heading 2
|
133
|
-
== Heading 2 =========
|
134
|
-
=== Heading 3
|
135
|
-
=== Heading 3 ===============
|
136
|
-
=== Heading 3 # with end-of-line comment
|
137
|
-
=== Heading 3 ## with end-of-line comment
|
138
|
-
=== Heading 3 ========= # with end-of-line comment
|
139
|
-
== Heading 2
|
140
|
-
==== Heading 4
|
141
|
-
= ?????
|
142
|
-
== ???
|
143
|
-
TXT
|
144
|
-
|
145
|
-
pp recs
|
146
|
-
|
147
|
-
assert_equal 0, recs.size
|
148
|
-
end
|
149
|
-
|
150
|
-
end # class TestClubReader
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_club_reader.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestClubReader < MiniTest::Test
|
11
|
+
|
12
|
+
def test_parse_at
|
13
|
+
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
14
|
+
==================================
|
15
|
+
= Austria (at)
|
16
|
+
|
17
|
+
FK Austria Wien, Wien
|
18
|
+
| Austria Vienna | Austria Wien
|
19
|
+
SK Rapid Wien, Wien
|
20
|
+
| Rapid Vienna | Rapid Wien
|
21
|
+
Wiener Sport-Club, Wien
|
22
|
+
TXT
|
23
|
+
|
24
|
+
pp recs
|
25
|
+
|
26
|
+
assert_equal 3, recs.size
|
27
|
+
assert_equal 'FK Austria Wien', recs[0].name
|
28
|
+
assert_equal 'Wien', recs[0].city
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_parse_us
|
32
|
+
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
33
|
+
==================================================
|
34
|
+
= United States (us)
|
35
|
+
|
36
|
+
#######################################
|
37
|
+
# Major League Soccer (MLS) teams
|
38
|
+
|
39
|
+
Atlanta United FC, 2017, Atlanta › Georgia
|
40
|
+
| Atlanta United
|
41
|
+
Chicago Fire, 1998, Bridgeview › Illinois
|
42
|
+
FC Dallas, 1996, Frisco › Texas ## note: FC Dallas named >Dallas Burn< from 1996-2004
|
43
|
+
|
44
|
+
##################################
|
45
|
+
# Defunct / Historic
|
46
|
+
Miami Fusion (1998-2001), Fort Lauderdale › Florida
|
47
|
+
CD Chivas USA (2005-2014), Carson › California
|
48
|
+
| Chivas USA
|
49
|
+
TXT
|
50
|
+
|
51
|
+
pp recs
|
52
|
+
|
53
|
+
assert_equal 5, recs.size
|
54
|
+
assert_equal 'Atlanta United FC', recs[0].name
|
55
|
+
assert_equal 2017, recs[0].year
|
56
|
+
assert_equal 'Atlanta', recs[0].city
|
57
|
+
assert_equal ['Georgia'], recs[0].geos
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def test_parse_years
|
62
|
+
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
63
|
+
= United States (us)
|
64
|
+
FC Dallas (1996-), Frisco › Texas
|
65
|
+
Miami Fusion (1998-2001), Fort Lauderdale › Florida
|
66
|
+
CD Chivas USA (-2014), Carson › California
|
67
|
+
TXT
|
68
|
+
|
69
|
+
pp recs
|
70
|
+
|
71
|
+
assert_equal 3, recs.size
|
72
|
+
assert_equal 1996, recs[0].year
|
73
|
+
assert_equal false, recs[0].historic?
|
74
|
+
assert_equal false, recs[0].past?
|
75
|
+
|
76
|
+
assert_equal 1998, recs[1].year
|
77
|
+
assert_equal 2001, recs[1].year_end
|
78
|
+
assert_equal true, recs[1].historic?
|
79
|
+
assert_equal true, recs[1].past?
|
80
|
+
|
81
|
+
assert_equal 2014, recs[2].year_end
|
82
|
+
assert_equal true, recs[2].historic?
|
83
|
+
assert_equal true, recs[2].past?
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_parse_geos
|
87
|
+
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
88
|
+
= England (eng)
|
89
|
+
== Greater London
|
90
|
+
|
91
|
+
Fulham FC, 1879, @ Craven Cottage, London (Fulham) › Greater London
|
92
|
+
| Fulham | FC Fulham
|
93
|
+
Charlton Athletic FC, @ The Valley, London (Charlton) › Greater London
|
94
|
+
| Charlton | Charlton Athletic
|
95
|
+
|
96
|
+
= Deutschland (de)
|
97
|
+
== Hamburg
|
98
|
+
|
99
|
+
St. Pauli, Hamburg (St. Pauli)
|
100
|
+
TXT
|
101
|
+
|
102
|
+
pp recs
|
103
|
+
|
104
|
+
assert_equal 3, recs.size
|
105
|
+
assert_equal 'London', recs[0].city
|
106
|
+
assert_equal 'Fulham', recs[0].district
|
107
|
+
assert_equal ['Greater London'], recs[0].geos
|
108
|
+
assert_equal 'England', recs[0].country.name
|
109
|
+
assert_equal 'eng', recs[0].country.key
|
110
|
+
|
111
|
+
assert_equal 'London', recs[1].city
|
112
|
+
assert_equal 'Charlton', recs[1].district
|
113
|
+
assert_equal ['Greater London'], recs[1].geos
|
114
|
+
assert_equal 'England', recs[1].country.name
|
115
|
+
assert_equal 'eng', recs[1].country.key
|
116
|
+
|
117
|
+
assert_equal 'Hamburg', recs[2].city
|
118
|
+
assert_equal 'St. Pauli', recs[2].district
|
119
|
+
assert_equal ['Hamburg'], recs[2].geos
|
120
|
+
assert_equal 'Germany', recs[2].country.name
|
121
|
+
assert_equal 'de', recs[2].country.key
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
def test_parse_headings
|
126
|
+
recs = SportDb::Import::ClubReader.parse( <<TXT )
|
127
|
+
==============
|
128
|
+
====
|
129
|
+
===========
|
130
|
+
= Heading 1 - Austria (at)
|
131
|
+
= Heading 1 - Austria (at) ==================
|
132
|
+
== Heading 2
|
133
|
+
== Heading 2 =========
|
134
|
+
=== Heading 3
|
135
|
+
=== Heading 3 ===============
|
136
|
+
=== Heading 3 # with end-of-line comment
|
137
|
+
=== Heading 3 ## with end-of-line comment
|
138
|
+
=== Heading 3 ========= # with end-of-line comment
|
139
|
+
== Heading 2
|
140
|
+
==== Heading 4
|
141
|
+
= ?????
|
142
|
+
== ???
|
143
|
+
TXT
|
144
|
+
|
145
|
+
pp recs
|
146
|
+
|
147
|
+
assert_equal 0, recs.size
|
148
|
+
end
|
149
|
+
|
150
|
+
end # class TestClubReader
|
data/test/test_clubs.rb
CHANGED
@@ -9,6 +9,19 @@ require 'helper'
|
|
9
9
|
|
10
10
|
class TestClubs < MiniTest::Test
|
11
11
|
|
12
|
+
def strip_lang( name ) SportDb::Import::Club.strip_lang( name ); end
|
13
|
+
def strip_year( name ) SportDb::Import::Club.strip_year( name ); end
|
14
|
+
|
15
|
+
|
16
|
+
def test_lang
|
17
|
+
assert_equal 'Bayern Munich', strip_lang( 'Bayern Munich [en]' )
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_year
|
21
|
+
assert_equal 'FC Linz', strip_year( 'FC Linz (1946-2001, 2013-)' )
|
22
|
+
end
|
23
|
+
|
24
|
+
|
12
25
|
def test_duplicats
|
13
26
|
club = SportDb::Import::Club.new
|
14
27
|
club.name = "Rapid Wien"
|
@@ -22,7 +35,7 @@ class TestClubs < MiniTest::Test
|
|
22
35
|
pp club
|
23
36
|
|
24
37
|
assert_equal true, club.duplicates?
|
25
|
-
duplicates = {'
|
38
|
+
duplicates = {'rapidwien'=>['Rapid Wien','Rapid Wien']}
|
26
39
|
pp club.duplicates
|
27
40
|
assert_equal duplicates, club.duplicates
|
28
41
|
end
|
data/test/test_league_reader.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_league_reader.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestLeagueReader < MiniTest::Test
|
11
|
-
|
12
|
-
def test_parse_eng
|
13
|
-
|
14
|
-
hash = SportDb::Import::LeagueReader.parse( <<TXT )
|
15
|
-
1 => premierleague, English Premier League
|
16
|
-
2 => championship, English Championship League
|
17
|
-
3 => league1, English League 1
|
18
|
-
4 => league2, English League 2
|
19
|
-
5 => conference, English Conference
|
20
|
-
|
21
|
-
#########################################
|
22
|
-
# until (including) 2003-04 season
|
23
|
-
|
24
|
-
[2003-04] # or just use 2003-04: or similar - why? why not?
|
25
|
-
# or use 2003/04 - 1992/93 - why? why not?
|
26
|
-
|
27
|
-
1 => premierleague, English Premier League
|
28
|
-
2 => division1, English Division 1
|
29
|
-
3 => division2, English Division 2
|
30
|
-
4 => division3, English Division 3
|
31
|
-
|
32
|
-
|
33
|
-
#############################################
|
34
|
-
# note: in season 1992/93 the premier league starts
|
35
|
-
# until (including) 1991-92} season
|
36
|
-
|
37
|
-
[1991-92]
|
38
|
-
1 => division1, English Division 1
|
39
|
-
2 => division2, English Division 2
|
40
|
-
3 => division3, English Division 3
|
41
|
-
3a => division3n, English Division 3 (North)
|
42
|
-
3b => division3s, English Division 3 (South)
|
43
|
-
4 => division4, English Division 4 ## check if real?
|
44
|
-
TXT
|
45
|
-
|
46
|
-
|
47
|
-
assert_equal 'premierleague', hash['*']['1']
|
48
|
-
assert_equal 'championship', hash['*']['2']
|
49
|
-
assert_equal 'league1', hash['*']['3']
|
50
|
-
|
51
|
-
assert_equal 'division1', hash['1991-92']['1']
|
52
|
-
assert_equal 'division2', hash['1991-92']['2']
|
53
|
-
end # method test_parse_eng
|
54
|
-
end # class TestLeagueUtils
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_league_reader.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestLeagueReader < MiniTest::Test
|
11
|
+
|
12
|
+
def test_parse_eng
|
13
|
+
|
14
|
+
hash = SportDb::Import::LeagueReader.parse( <<TXT )
|
15
|
+
1 => premierleague, English Premier League
|
16
|
+
2 => championship, English Championship League
|
17
|
+
3 => league1, English League 1
|
18
|
+
4 => league2, English League 2
|
19
|
+
5 => conference, English Conference
|
20
|
+
|
21
|
+
#########################################
|
22
|
+
# until (including) 2003-04 season
|
23
|
+
|
24
|
+
[2003-04] # or just use 2003-04: or similar - why? why not?
|
25
|
+
# or use 2003/04 - 1992/93 - why? why not?
|
26
|
+
|
27
|
+
1 => premierleague, English Premier League
|
28
|
+
2 => division1, English Division 1
|
29
|
+
3 => division2, English Division 2
|
30
|
+
4 => division3, English Division 3
|
31
|
+
|
32
|
+
|
33
|
+
#############################################
|
34
|
+
# note: in season 1992/93 the premier league starts
|
35
|
+
# until (including) 1991-92} season
|
36
|
+
|
37
|
+
[1991-92]
|
38
|
+
1 => division1, English Division 1
|
39
|
+
2 => division2, English Division 2
|
40
|
+
3 => division3, English Division 3
|
41
|
+
3a => division3n, English Division 3 (North)
|
42
|
+
3b => division3s, English Division 3 (South)
|
43
|
+
4 => division4, English Division 4 ## check if real?
|
44
|
+
TXT
|
45
|
+
|
46
|
+
|
47
|
+
assert_equal 'premierleague', hash['*']['1']
|
48
|
+
assert_equal 'championship', hash['*']['2']
|
49
|
+
assert_equal 'league1', hash['*']['3']
|
50
|
+
|
51
|
+
assert_equal 'division1', hash['1991-92']['1']
|
52
|
+
assert_equal 'division2', hash['1991-92']['2']
|
53
|
+
end # method test_parse_eng
|
54
|
+
end # class TestLeagueUtils
|
data/test/test_league_utils.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_league_utils.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestLeagueUtils < MiniTest::Test
|
11
|
-
|
12
|
-
def test_basename_eng
|
13
|
-
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng', season: '2011-12' )
|
14
|
-
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng' )
|
15
|
-
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng-england' ) ## allow country code or (repo) package name
|
16
|
-
assert_equal '1-division1', LeagueUtils.basename( '1', country: 'eng', season: '1991-92' )
|
17
|
-
assert_equal '3a', LeagueUtils.basename( '3a', country: 'eng', season: '2011-12' )
|
18
|
-
|
19
|
-
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng', season: '2011-12' )
|
20
|
-
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng' )
|
21
|
-
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng-england' ) ## allow country code or (repo) package name
|
22
|
-
assert_equal '2-division1', LeagueUtils.basename( '2', country: 'eng', season: '2003-04' )
|
23
|
-
assert_equal '2-division2', LeagueUtils.basename( '2', country: 'eng', season: '1991-92' )
|
24
|
-
assert_equal '2-division2', LeagueUtils.basename( '2', country: 'eng', season: '1989-90' )
|
25
|
-
end # method test_basename
|
26
|
-
|
27
|
-
def test_basename_sco
|
28
|
-
assert_equal '1-premiership', LeagueUtils.basename( '1', country: 'sco' )
|
29
|
-
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'sco', season: '2012-13' )
|
30
|
-
assert_equal '1-premierdivision', LeagueUtils.basename( '1', country: 'sco', season: '1997-98' )
|
31
|
-
|
32
|
-
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'sco' )
|
33
|
-
assert_equal '2-division1', LeagueUtils.basename( '2', country: 'sco', season: '2012-13' )
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_basename_fr
|
37
|
-
assert_equal '1-ligue1', LeagueUtils.basename( '1', country: 'fr' )
|
38
|
-
assert_equal '1-division1', LeagueUtils.basename( '1', country: 'fr', season: '2001-02' )
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_basename_gr
|
42
|
-
assert_equal '1-superleague', LeagueUtils.basename( '1', country: 'gr' )
|
43
|
-
assert_equal '1-alphaethniki', LeagueUtils.basename( '1', country: 'gr', season: '2005-06' )
|
44
|
-
end
|
45
|
-
|
46
|
-
end # class TestLeagueUtils
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_league_utils.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestLeagueUtils < MiniTest::Test
|
11
|
+
|
12
|
+
def test_basename_eng
|
13
|
+
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng', season: '2011-12' )
|
14
|
+
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng' )
|
15
|
+
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'eng-england' ) ## allow country code or (repo) package name
|
16
|
+
assert_equal '1-division1', LeagueUtils.basename( '1', country: 'eng', season: '1991-92' )
|
17
|
+
assert_equal '3a', LeagueUtils.basename( '3a', country: 'eng', season: '2011-12' )
|
18
|
+
|
19
|
+
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng', season: '2011-12' )
|
20
|
+
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng' )
|
21
|
+
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'eng-england' ) ## allow country code or (repo) package name
|
22
|
+
assert_equal '2-division1', LeagueUtils.basename( '2', country: 'eng', season: '2003-04' )
|
23
|
+
assert_equal '2-division2', LeagueUtils.basename( '2', country: 'eng', season: '1991-92' )
|
24
|
+
assert_equal '2-division2', LeagueUtils.basename( '2', country: 'eng', season: '1989-90' )
|
25
|
+
end # method test_basename
|
26
|
+
|
27
|
+
def test_basename_sco
|
28
|
+
assert_equal '1-premiership', LeagueUtils.basename( '1', country: 'sco' )
|
29
|
+
assert_equal '1-premierleague', LeagueUtils.basename( '1', country: 'sco', season: '2012-13' )
|
30
|
+
assert_equal '1-premierdivision', LeagueUtils.basename( '1', country: 'sco', season: '1997-98' )
|
31
|
+
|
32
|
+
assert_equal '2-championship', LeagueUtils.basename( '2', country: 'sco' )
|
33
|
+
assert_equal '2-division1', LeagueUtils.basename( '2', country: 'sco', season: '2012-13' )
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_basename_fr
|
37
|
+
assert_equal '1-ligue1', LeagueUtils.basename( '1', country: 'fr' )
|
38
|
+
assert_equal '1-division1', LeagueUtils.basename( '1', country: 'fr', season: '2001-02' )
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_basename_gr
|
42
|
+
assert_equal '1-superleague', LeagueUtils.basename( '1', country: 'gr' )
|
43
|
+
assert_equal '1-alphaethniki', LeagueUtils.basename( '1', country: 'gr', season: '2005-06' )
|
44
|
+
end
|
45
|
+
|
46
|
+
end # class TestLeagueUtils
|
data/test/test_season_utils.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_season_utils.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
class TestSeasonUtils < MiniTest::Test
|
11
|
-
|
12
|
-
def test_directory
|
13
|
-
assert_equal '2010-11', SeasonUtils.directory( '2010-11' )
|
14
|
-
assert_equal '2010-11', SeasonUtils.directory( '2010-2011' )
|
15
|
-
assert_equal '2010-11', SeasonUtils.directory( '2010/11' )
|
16
|
-
assert_equal '2010-11', SeasonUtils.directory( '2010/2011' )
|
17
|
-
assert_equal '2010', SeasonUtils.directory( '2010' )
|
18
|
-
|
19
|
-
assert_equal '2010s/2010-11', SeasonUtils.directory( '2010-11', format: 'long' )
|
20
|
-
assert_equal '2010s/2010-11', SeasonUtils.directory( '2010-2011', format: 'long' )
|
21
|
-
assert_equal '2010s/2010', SeasonUtils.directory( '2010', format: 'long' )
|
22
|
-
|
23
|
-
assert_equal '1999-00', SeasonUtils.directory( '1999-00' )
|
24
|
-
assert_equal '1999-00', SeasonUtils.directory( '1999-2000' )
|
25
|
-
assert_equal '1990s/1999-00', SeasonUtils.directory( '1999-00', format: 'long' )
|
26
|
-
assert_equal '1990s/1999-00', SeasonUtils.directory( '1999-2000', format: 'long' )
|
27
|
-
end # method test_diretory
|
28
|
-
|
29
|
-
end # class TestSeasonlUtils
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_season_utils.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
class TestSeasonUtils < MiniTest::Test
|
11
|
+
|
12
|
+
def test_directory
|
13
|
+
assert_equal '2010-11', SeasonUtils.directory( '2010-11' )
|
14
|
+
assert_equal '2010-11', SeasonUtils.directory( '2010-2011' )
|
15
|
+
assert_equal '2010-11', SeasonUtils.directory( '2010/11' )
|
16
|
+
assert_equal '2010-11', SeasonUtils.directory( '2010/2011' )
|
17
|
+
assert_equal '2010', SeasonUtils.directory( '2010' )
|
18
|
+
|
19
|
+
assert_equal '2010s/2010-11', SeasonUtils.directory( '2010-11', format: 'long' )
|
20
|
+
assert_equal '2010s/2010-11', SeasonUtils.directory( '2010-2011', format: 'long' )
|
21
|
+
assert_equal '2010s/2010', SeasonUtils.directory( '2010', format: 'long' )
|
22
|
+
|
23
|
+
assert_equal '1999-00', SeasonUtils.directory( '1999-00' )
|
24
|
+
assert_equal '1999-00', SeasonUtils.directory( '1999-2000' )
|
25
|
+
assert_equal '1990s/1999-00', SeasonUtils.directory( '1999-00', format: 'long' )
|
26
|
+
assert_equal '1990s/1999-00', SeasonUtils.directory( '1999-2000', format: 'long' )
|
27
|
+
end # method test_diretory
|
28
|
+
|
29
|
+
end # class TestSeasonlUtils
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: csvreader
|
@@ -28,36 +28,30 @@ dependencies:
|
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '7'
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- - "
|
38
|
+
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: '4.0'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '7'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: hoe
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
47
|
+
version: '3.16'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
54
|
+
version: '3.16'
|
61
55
|
description: sportdb-config - sport.db configuration settings and built-in defaults
|
62
56
|
email: opensport@googlegroups.com
|
63
57
|
executables: []
|