sportdb-config 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -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
@@ -12,6 +12,12 @@ class TestVariants < MiniTest::Test
12
12
  def variants( name ) SportDb::Import::Variant.find( name ); end
13
13
 
14
14
 
15
+ def test_downcase
16
+ ## todo/fix: use our own downcase for normalize - why? why not?
17
+ ## assert_equal 'äöü', 'ÄÖÜ'.downcase
18
+ end
19
+
20
+
15
21
  def test_de
16
22
  assert_equal [], variants( 'Augsburg' )
17
23
 
@@ -27,5 +33,13 @@ class TestVariants < MiniTest::Test
27
33
  assert_equal ['St. Polten', 'St. Poelten'], variants( 'St. Pölten' )
28
34
  end
29
35
 
36
+ def test_es
37
+ assert_equal [], variants( 'Madrid' )
38
+
39
+ assert_equal ['Atletico Madrid'], variants( 'Atlético Madrid' )
40
+ assert_equal ['Ecija Balompie'], variants( 'Écija Balompié' )
41
+ assert_equal ['La Coruna'], variants( 'La Coruña' )
42
+ assert_equal ['Almeria'], variants( 'Almería' )
43
+ end
30
44
 
31
45
  end # class TestVariants
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.0
4
+ version: 0.4.1
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-07-30 00:00:00.000000000 Z
11
+ date: 2019-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csvreader
@@ -28,30 +28,36 @@ 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'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: hoe
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '3.16'
53
+ version: '3.18'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '3.16'
60
+ version: '3.18'
55
61
  description: sportdb-config - sport.db configuration settings and built-in defaults
56
62
  email: opensport@googlegroups.com
57
63
  executables: []