sportdb-config 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,150 +0,0 @@
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,46 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_variants.rb
6
-
7
-
8
- require 'helper'
9
-
10
- class TestVariants < MiniTest::Test
11
-
12
- def variants( name ) SportDb::Import::Variant.find( name ); end
13
-
14
-
15
- def test_downcase_i18n
16
- assert_equal 'abcdefghijklmnopqrstuvwxyz', downcase_i18n( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )
17
- assert_equal 'äöü', downcase_i18n( 'ÄÖÜ' )
18
- assert_equal 'köln', downcase_i18n( 'KÖLN' )
19
- end
20
-
21
-
22
- def test_de
23
- assert_equal [], variants( 'Augsburg' )
24
-
25
- assert_equal ['Koln', 'Koeln'], variants( 'Köln' )
26
- assert_equal ['1. FC Koln', '1. FC Koeln'], variants( '1. FC Köln' )
27
-
28
- assert_equal ['Bayern Munchen', 'Bayern Muenchen'], variants( 'Bayern München' )
29
- assert_equal ['F. Dusseldorf', 'F. Duesseldorf'], variants( 'F. Düsseldorf' )
30
- assert_equal ['Preussen'], variants( 'Preußen' )
31
- assert_equal ['Munster Preussen', 'Muenster Preussen'], variants( 'Münster Preußen' )
32
- assert_equal ['Rot-Weiss Oberhausen'], variants( 'Rot-Weiß Oberhausen' )
33
-
34
- assert_equal ['St. Polten', 'St. Poelten'], variants( 'St. Pölten' )
35
- end
36
-
37
- def test_es
38
- assert_equal [], variants( 'Madrid' )
39
-
40
- assert_equal ['Atletico Madrid'], variants( 'Atlético Madrid' )
41
- assert_equal ['Ecija Balompie'], variants( 'Écija Balompié' )
42
- assert_equal ['La Coruna'], variants( 'La Coruña' )
43
- assert_equal ['Almeria'], variants( 'Almería' )
44
- end
45
-
46
- end # class TestVariants
@@ -1,77 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_wiki_reader.rb
6
-
7
-
8
- require 'helper'
9
-
10
- class TestWikiReader < MiniTest::Test
11
-
12
- def test_parse_at
13
- recs = SportDb::Import::WikiReader.parse( <<TXT )
14
- ===================================
15
- = Albania (al)
16
-
17
- FK Partizani Tirana
18
- KF Tirana
19
- FK Kukësi
20
- KF Laçi
21
- TXT
22
-
23
- pp recs
24
-
25
- assert_equal 4, recs.size
26
- assert_equal 'FK Partizani Tirana', recs[0].name
27
- assert_equal 'Albania', recs[0].country.name
28
- assert_equal 'al', recs[0].country.key
29
- end
30
-
31
-
32
- def test_parse_be
33
- recs = SportDb::Import::WikiReader.parse( <<TXT )
34
- ===========================
35
- = Belgium (be)
36
-
37
- R.S.C._Anderlecht
38
- Royal_Antwerp_F.C.
39
- Cercle_Brugge_K.S.V.
40
- R._Charleroi_S.C.
41
- Club_Brugge_KV
42
- TXT
43
-
44
- pp recs
45
-
46
- assert_equal 5, recs.size
47
- assert_equal 'R.S.C. Anderlecht', recs[0].name
48
- assert_equal 'Belgium', recs[0].country.name
49
- assert_equal 'be', recs[0].country.key
50
- end
51
-
52
- def test_parse_world
53
- recs = SportDb::Import::WikiReader.parse( <<TXT )
54
- = Albania (al) =
55
-
56
- FK Partizani Tirana
57
-
58
-
59
- = Belgium (be) =
60
-
61
- # some comments here
62
- R.S.C._Anderlecht # some end-of-line comments here
63
- TXT
64
-
65
- pp recs
66
-
67
- assert_equal 2, recs.size
68
- assert_equal 'FK Partizani Tirana', recs[0].name
69
- assert_equal 'Albania', recs[0].country.name
70
- assert_equal 'al', recs[0].country.key
71
-
72
- assert_equal 'R.S.C. Anderlecht', recs[1].name
73
- assert_equal 'Belgium', recs[1].country.name
74
- assert_equal 'be', recs[1].country.key
75
- end
76
-
77
- end # class TestWikiReader