sapor 0.4.0 → 0.4.1

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sapor/poll.rb +1 -13
  3. data/lib/sapor/regional_data/european_union_austria.rb +1 -1
  4. data/lib/sapor/regional_data/european_union_croatia.rb +1 -1
  5. data/lib/sapor/regional_data/european_union_denmark.rb +1 -1
  6. data/lib/sapor/regional_data/european_union_estonia.rb +1 -1
  7. data/lib/sapor/regional_data/european_union_finland.rb +1 -1
  8. data/lib/sapor/regional_data/european_union_france.rb +1 -1
  9. data/lib/sapor/regional_data/european_union_ireland.rb +2 -2
  10. data/lib/sapor/regional_data/european_union_ireland_with_ia.rb +2 -2
  11. data/lib/sapor/regional_data/european_union_italy.rb +1 -1
  12. data/lib/sapor/regional_data/european_union_netherlands.rb +1 -1
  13. data/lib/sapor/regional_data/european_union_poland.rb +1 -1
  14. data/lib/sapor/regional_data/european_union_spain.rb +1 -1
  15. data/lib/sapor.rb +0 -12
  16. data/sapor.gemspec +1 -1
  17. data/spec/unit/european_union_austria_spec.rb +3 -3
  18. data/spec/unit/european_union_croatia_spec.rb +5 -4
  19. data/spec/unit/european_union_denmark_spec.rb +5 -4
  20. data/spec/unit/european_union_estonia_spec.rb +5 -4
  21. data/spec/unit/european_union_finland_spec.rb +3 -3
  22. data/spec/unit/european_union_france_spec.rb +6 -6
  23. data/spec/unit/european_union_ireland_spec.rb +4 -4
  24. data/spec/unit/european_union_ireland_with_ia_spec.rb +4 -4
  25. data/spec/unit/european_union_italy_spec.rb +5 -5
  26. data/spec/unit/european_union_netherlands_spec.rb +5 -5
  27. data/spec/unit/european_union_poland_spec.rb +3 -3
  28. data/spec/unit/european_union_spain_spec.rb +7 -6
  29. metadata +2 -38
  30. data/lib/sapor/regional_data/european_union_27_austria.rb +0 -76
  31. data/lib/sapor/regional_data/european_union_27_croatia.rb +0 -83
  32. data/lib/sapor/regional_data/european_union_27_denmark.rb +0 -77
  33. data/lib/sapor/regional_data/european_union_27_estonia.rb +0 -74
  34. data/lib/sapor/regional_data/european_union_27_finland.rb +0 -74
  35. data/lib/sapor/regional_data/european_union_27_france.rb +0 -84
  36. data/lib/sapor/regional_data/european_union_27_ireland.rb +0 -96
  37. data/lib/sapor/regional_data/european_union_27_ireland_with_ia.rb +0 -97
  38. data/lib/sapor/regional_data/european_union_27_italy.rb +0 -84
  39. data/lib/sapor/regional_data/european_union_27_netherlands.rb +0 -81
  40. data/lib/sapor/regional_data/european_union_27_poland.rb +0 -84
  41. data/lib/sapor/regional_data/european_union_27_spain.rb +0 -82
  42. data/spec/unit/european_union_27_austria_spec.rb +0 -61
  43. data/spec/unit/european_union_27_croatia_spec.rb +0 -60
  44. data/spec/unit/european_union_27_denmark_spec.rb +0 -62
  45. data/spec/unit/european_union_27_estonia_spec.rb +0 -94
  46. data/spec/unit/european_union_27_finland_spec.rb +0 -75
  47. data/spec/unit/european_union_27_france_spec.rb +0 -73
  48. data/spec/unit/european_union_27_ireland_spec.rb +0 -72
  49. data/spec/unit/european_union_27_ireland_with_ia_spec.rb +0 -74
  50. data/spec/unit/european_union_27_italy_spec.rb +0 -69
  51. data/spec/unit/european_union_27_netherlands_spec.rb +0 -81
  52. data/spec/unit/european_union_27_poland_spec.rb +0 -69
  53. data/spec/unit/european_union_27_spain_spec.rb +0 -130
@@ -1,73 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27France, '#area_code' do
23
- it 'returns EU27[FR] as the area code' do
24
- expect(Sapor::EuropeanUnion27France.instance.area_code).to eq('EU27[FR]')
25
- end
26
- end
27
-
28
- describe Sapor::EuropeanUnion27France, '#no_of_seats' do
29
- it 'returns 79 as the number of seats' do
30
- expect(Sapor::EuropeanUnion27France.instance.no_of_seats).to eq(79)
31
- end
32
- end
33
-
34
- describe Sapor::EuropeanUnion27France, '#population_size' do
35
- it 'returns a population size of 22,655,174' do
36
- expect(Sapor::EuropeanUnion27France.instance.population_size).to \
37
- eq(22_655_174)
38
- end
39
- end
40
-
41
- describe Sapor::EuropeanUnion27France, '#seats' do
42
- it 'calculates the number of seats using the votes of the 2014 election' do
43
- results = { 'Front national–Rassemblement bleu Marine (ENF)' => 4_712_461,
44
- 'Union pour un mouvement populaire (EPP)' => 3_943_819,
45
- 'Parti socialiste–Parti radical de gauche (S&D)' => 2_650_357,
46
- 'L’Alternative (ALDE)' => 1_884_565,
47
- 'Europe Écologie Les Verts (Greens/EFA)' => 1_696_442,
48
- 'Front de gauche–L’Union pour les Outremer (GUE/NGL)' =>
49
- 1_252_730,
50
- 'Debout la République (—)' => 724_441,
51
- 'Nouvelle Donne (—)' => 549_734, 'Nous Citoyens (—)' => 266_343,
52
- 'Lutte ouvrière (—)' => 222_491,
53
- 'Alliance écologiste indépendante (—)' => 211_759,
54
- 'Force vie' => 138_708, 'Europe citoyenne (—)' => 127_849,
55
- 'Parti du vote blanc (—)' => 110_090 }
56
- seats = Sapor::EuropeanUnion27France.instance.seats(results)
57
- expect(seats['Front national–Rassemblement bleu Marine (ENF)']).to eq(22 + 1)
58
- expect(seats['Union pour un mouvement populaire (EPP)']).to eq(18 + 2)
59
- expect(seats['Parti socialiste–Parti radical de gauche (S&D)']).to eq(12 + 1)
60
- expect(seats['L’Alternative (ALDE)']).to eq(9)
61
- expect(seats['Europe Écologie Les Verts (Greens/EFA)']).to eq(8)
62
- expect(seats['Front de gauche–L’Union pour les Outremer (GUE/NGL)']).to \
63
- eq(5 + 1)
64
- expect(seats['Debout la République (—)']).to eq(0)
65
- expect(seats['Nouvelle Donne (—)']).to eq(0)
66
- expect(seats['Nous Citoyens (—)']).to eq(0)
67
- expect(seats['Lutte ouvrière (—)']).to eq(0)
68
- expect(seats['Alliance écologiste indépendante (—)']).to eq(0)
69
- expect(seats['Force vie']).to eq(0)
70
- expect(seats['Europe citoyenne (—)']).to eq(0)
71
- expect(seats['Parti du vote blanc (—)']).to eq(0)
72
- end
73
- end
@@ -1,72 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27Ireland, '#area_code' do
23
- it 'returns EU[IE]@2019 as the area code' do
24
- expect(Sapor::EuropeanUnion27Ireland.instance.area_code).to \
25
- eq('EU27[IE]')
26
- end
27
- end
28
-
29
- describe Sapor::EuropeanUnion27Ireland, '#no_of_seats' do
30
- it 'returns 13 as the number of seats' do
31
- expect(Sapor::EuropeanUnion27Ireland.instance.no_of_seats).to eq(13)
32
- end
33
- end
34
-
35
- describe Sapor::EuropeanUnion27Ireland, '#population_size' do
36
- it 'returns a population size of 1,678,003' do
37
- expect(Sapor::EuropeanUnion27Ireland.instance.population_size).to \
38
- eq(1_678_003)
39
- end
40
- end
41
-
42
- describe Sapor::EuropeanUnion27Ireland, '#seats' do
43
- it 'calculates the number of seats for the election of 2019' do
44
- results = { 'Fine Gael (EPP)' => 496_459,
45
- 'Green Party (Greens/EFA)' => 190_755,
46
- 'Independents 4 Change (GUE/NGL)' => 124_085,
47
- 'Fianna Fáil (RE)' => 277_705,
48
- 'Sinn Féin (GUE/NGL)' => 196_001,
49
- 'Labour Party (S&D)' => 52_753,
50
- 'Solidarity–People Before Profit (GUE/NGL)' => 38_771,
51
- 'Social Democrats (S&D)' => 20_331,
52
- 'Renua Ireland (*)' => 6_897,
53
- 'Workers’ Party (NI)' => 3_701,
54
- 'Identity Ireland (*)' => 3_685,
55
- 'Direct Democracy Ireland (*)' => 2_773,
56
- 'Independents (*)' => 264_087 }
57
- seats = Sapor::EuropeanUnion27Ireland.instance.seats(results)
58
- expect(seats['Fine Gael (EPP)']).to eq(4 + 1)
59
- expect(seats['Green Party (Greens/EFA)']).to eq(2 - 1)
60
- expect(seats['Independents 4 Change (GUE/NGL)']).to eq(2 - 1 + 1)
61
- expect(seats['Fianna Fáil (RE)']).to eq(1 + 1)
62
- expect(seats['Sinn Féin (GUE/NGL)']).to eq(1 - 1 + 1)
63
- expect(seats['Labour Party (S&D)']).to eq(0)
64
- expect(seats['Solidarity–People Before Profit (GUE/NGL)']).to eq(0)
65
- expect(seats['Social Democrats (S&D)']).to eq(0)
66
- expect(seats['Renua Ireland (*)']).to eq(0)
67
- expect(seats['Workers’ Party (NI)']).to eq(0)
68
- expect(seats['Identity Ireland (*)']).to eq(0)
69
- expect(seats['Direct Democracy Ireland (*)']).to eq(0)
70
- expect(seats['Independents (*)']).to eq(1 + 1)
71
- end
72
- end
@@ -1,74 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27IrelandWithIa, '#area_code' do
23
- it 'returns EU[IE]@2019∪{IA} as the area code' do
24
- expect(Sapor::EuropeanUnion27IrelandWithIa.instance.area_code).to \
25
- eq('EU27[IE]∪{IA}')
26
- end
27
- end
28
-
29
- describe Sapor::EuropeanUnion27IrelandWithIa, '#no_of_seats' do
30
- it 'returns 13 as the number of seats' do
31
- expect(Sapor::EuropeanUnion27IrelandWithIa.instance.no_of_seats).to eq(13)
32
- end
33
- end
34
-
35
- describe Sapor::EuropeanUnion27IrelandWithIa, '#population_size' do
36
- it 'returns a population size of 1,678,003' do
37
- expect(Sapor::EuropeanUnion27IrelandWithIa.instance.population_size).to \
38
- eq(1_678_003)
39
- end
40
- end
41
-
42
- describe Sapor::EuropeanUnion27IrelandWithIa, '#seats' do
43
- it 'calculates the number of seats for the election of 2019' do
44
- results = { 'Fine Gael (EPP)' => 496_459,
45
- 'Green Party (Greens/EFA)' => 190_755,
46
- 'Independents 4 Change (GUE/NGL)' => 124_085,
47
- 'Fianna Fáil (RE)' => 277_705,
48
- 'Sinn Féin (GUE/NGL)' => 196_001,
49
- 'Labour Party (S&D)' => 52_753,
50
- 'Solidarity–People Before Profit (GUE/NGL)' => 38_771,
51
- 'Social Democrats (S&D)' => 20_331,
52
- 'Renua Ireland (*)' => 6_897,
53
- 'Workers’ Party (NI)' => 3_701,
54
- 'Identity Ireland (*)' => 3_685,
55
- 'Direct Democracy Ireland (*)' => 2_773,
56
- 'Independents (*)' => 264_087,
57
- 'Independent Alliance (*)' => 264_087 }
58
- seats = Sapor::EuropeanUnion27IrelandWithIa.instance.seats(results)
59
- expect(seats['Fine Gael (EPP)']).to eq(4 + 1)
60
- expect(seats['Green Party (Greens/EFA)']).to eq(2 - 1)
61
- expect(seats['Independents 4 Change (GUE/NGL)']).to eq(2 - 1 + 1)
62
- expect(seats['Fianna Fáil (RE)']).to eq(1 + 1)
63
- expect(seats['Sinn Féin (GUE/NGL)']).to eq(1 - 1 + 1)
64
- expect(seats['Labour Party (S&D)']).to eq(0)
65
- expect(seats['Solidarity–People Before Profit (GUE/NGL)']).to eq(0)
66
- expect(seats['Social Democrats (S&D)']).to eq(0)
67
- expect(seats['Renua Ireland (*)']).to eq(0)
68
- expect(seats['Workers’ Party (NI)']).to eq(0)
69
- expect(seats['Identity Ireland (*)']).to eq(0)
70
- expect(seats['Direct Democracy Ireland (*)']).to eq(0)
71
- expect(seats['Independents (*)']).to eq(1 + 1 - 1)
72
- expect(seats['Independent Alliance (*)']).to eq(1 + 1 - 1)
73
- end
74
- end
@@ -1,69 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27Italy, '#area_code' do
23
- it 'returns EU27[IT] as the area code' do
24
- expect(Sapor::EuropeanUnion27Italy.instance.area_code).to eq('EU27[IT]')
25
- end
26
- end
27
-
28
- describe Sapor::EuropeanUnion27Italy, '#no_of_seats' do
29
- it 'returns 76 as the number of seats' do
30
- expect(Sapor::EuropeanUnion27Italy.instance.no_of_seats).to eq(76)
31
- end
32
- end
33
-
34
- describe Sapor::EuropeanUnion27Italy, '#population_size' do
35
- it 'returns a population size of 26,783,732' do
36
- expect(Sapor::EuropeanUnion27Italy.instance.population_size).to \
37
- eq(26_783_732)
38
- end
39
- end
40
-
41
- describe Sapor::EuropeanUnion27Italy, '#seats' do
42
- it 'calculates the number of seats using the votes of the 2014 election' do
43
- results = { 'Partito Democratico (S&D)' => 11_203_231,
44
- 'Movimento 5 Stelle (EFDD)' => 5_792_865,
45
- 'Forza Italia (EPP)' => 4_614_364,
46
- 'Lega Nord (ENF)' => 1_688_197,
47
- 'Nuovo Centrodestra–Unione di Centro (EPP)' => 1_202_350,
48
- 'L’Altra Europa con Tsipras (GUE/NGL)' => 1_108_457,
49
- 'Fratelli d’Italia (—)' => 1_006_513,
50
- 'Verdi Europei–Green Italia (Greens/EFA)' => 250_102,
51
- 'Scelta Europea (ALDE)' => 197_942,
52
- 'Italia dei Valori (ALDE)' => 181_373,
53
- 'Südtiroler Volkspartei (EPP)' => 138_037,
54
- 'Io Cambio–MAIE (—)' => 50_978 }
55
- seats = Sapor::EuropeanUnion27Italy.instance.seats(results)
56
- expect(seats['Partito Democratico (S&D)']).to eq(31 + 1)
57
- expect(seats['Movimento 5 Stelle (EFDD)']).to eq(17)
58
- expect(seats['Forza Italia (EPP)']).to eq(13 + 1)
59
- expect(seats['Lega Nord (ENF)']).to eq(5)
60
- expect(seats['Nuovo Centrodestra–Unione di Centro (EPP)']).to eq(3 + 1)
61
- expect(seats['L’Altra Europa con Tsipras (GUE/NGL)']).to eq(3)
62
- expect(seats['Fratelli d’Italia (—)']).to eq(0)
63
- expect(seats['Verdi Europei–Green Italia (Greens/EFA)']).to eq(0)
64
- expect(seats['Scelta Europea (ALDE)']).to eq(0)
65
- expect(seats['Italia dei Valori (ALDE)']).to eq(0)
66
- expect(seats['Südtiroler Volkspartei (EPP)']).to eq(1)
67
- expect(seats['Io Cambio–MAIE (—)']).to eq(0)
68
- end
69
- end
@@ -1,81 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27Netherlands, '#area_code' do
23
- it 'returns EU27[NL] as the area code' do
24
- expect(Sapor::EuropeanUnion27Netherlands.instance.area_code).to eq('EU27[NL]')
25
- end
26
- end
27
-
28
- describe Sapor::EuropeanUnion27Netherlands, '#no_of_seats' do
29
- it 'returns 29 as the number of seats' do
30
- expect(Sapor::EuropeanUnion27Netherlands.instance.no_of_seats).to eq(29)
31
- end
32
- end
33
-
34
- describe Sapor::EuropeanUnion27Netherlands, '#population_size' do
35
- it 'returns a population size of 5,497,813' do
36
- expect(Sapor::EuropeanUnion27Netherlands.instance.population_size).to \
37
- eq(5_497_813)
38
- end
39
- end
40
-
41
- describe Sapor::EuropeanUnion27Netherlands, '#seats' do
42
- it 'calculates the number of seats for the election of 2014' do
43
- results = { 'Democraten 66 (ALDE)' => 735_825,
44
- 'Christen-Democratisch Appèl–ChristenUnie–Staatkundig' \
45
- ' Gereformeerde Partij (EPP)' => 721_766 + 364_843,
46
- 'Partij voor de Vrijheid (ENF)' => 633_114,
47
- 'Volkspartij voor Vrijheid en Democratie (ALDE)' => 571_176,
48
- 'Socialistische Partij (GUE/NGL)' => 458_079,
49
- 'Partij van de Arbeid–GroenLinks (S&D)' => 446_763 + 331_594,
50
- 'Partij voor de Dieren (GUE/NGL)' => 200_254,
51
- '50Plus (ALDE)' => 175_343,
52
- 'Piratenpartij (Greens/EFA)' => 40_216,
53
- 'Artikel 50 (—)' => 24_069,
54
- 'Anti Europa Partij (—)' => 12_290,
55
- 'De Groenen (Greens/EFA)' => 10_833,
56
- 'Jezus Leeft (—)' => 9_507,
57
- 'ikkiesvooreerlijk.eu (—)' => 6_796,
58
- 'Liberaal Democratische Partij (—)' => 6_349,
59
- 'Aandacht en Eenvoud (—)' => 3_174,
60
- 'IQ, de Rechten-Plichten-Partij (—)' => 1_705 }
61
- seats = Sapor::EuropeanUnion27Netherlands.instance.seats(results)
62
- expect(seats['Democraten 66 (ALDE)']).to eq(4 + 1)
63
- expect(seats['Christen-Democratisch Appèl–ChristenUnie–Staatkundig' \
64
- ' Gereformeerde Partij (EPP)']).to eq(5 + 2)
65
- expect(seats['Partij voor de Vrijheid (ENF)']).to eq(4)
66
- expect(seats['Volkspartij voor Vrijheid en Democratie (ALDE)']).to eq(3)
67
- expect(seats['Socialistische Partij (GUE/NGL)']).to eq(2 + 1)
68
- expect(seats['Partij van de Arbeid–GroenLinks (S&D)']).to eq(3 + 2)
69
- expect(seats['Partij voor de Dieren (GUE/NGL)']).to eq(1)
70
- expect(seats['50Plus (ALDE)']).to eq(0 + 1)
71
- expect(seats['Piratenpartij (Greens/EFA)']).to eq(0)
72
- expect(seats['Artikel 50 (—)']).to eq(0)
73
- expect(seats['Anti Europa Partij (—)']).to eq(0)
74
- expect(seats['De Groenen (Greens/EFA)']).to eq(0)
75
- expect(seats['Jezus Leeft (—)']).to eq(0)
76
- expect(seats['ikkiesvooreerlijk.eu (—)']).to eq(0)
77
- expect(seats['Liberaal Democratische Partij (—)']).to eq(0)
78
- expect(seats['Aandacht en Eenvoud (—)']).to eq(0)
79
- expect(seats['IQ, de Rechten-Plichten-Partij (—)']).to eq(0)
80
- end
81
- end
@@ -1,69 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27Poland, '#area_code' do
23
- it 'returns EU27[PL] as the area code' do
24
- expect(Sapor::EuropeanUnion27Poland.instance.area_code).to eq('EU27[PL]')
25
- end
26
- end
27
-
28
- describe Sapor::EuropeanUnion27Poland, '#no_of_seats' do
29
- it 'returns 52 as the number of seats' do
30
- expect(Sapor::EuropeanUnion27Poland.instance.no_of_seats).to eq(52)
31
- end
32
- end
33
-
34
- describe Sapor::EuropeanUnion27Poland, '#population_size' do
35
- it 'returns a population size of 13,647,311' do
36
- expect(Sapor::EuropeanUnion27Poland.instance.population_size).to \
37
- eq(13_647_311)
38
- end
39
- end
40
-
41
- describe Sapor::EuropeanUnion27Poland, '#seats' do
42
- it 'calculates the number of seats for the election of 2014' do
43
- results = { 'Platforma Obywatelska (EPP)' => 2_271_215,
44
- 'Prawo i Sprawiedliwość (ECR)' => 2_246_870,
45
- 'Sojusz Lewicy Demokratycznej–Unia Pracy (S&D)' => 667_319,
46
- 'Kongres Nowej Prawicy (ENF)' => 505_586,
47
- 'Polskie Stronnictwo Ludowe (EPP)' => 480_846,
48
- 'Solidarna Polska Zbigniewa Ziobro (EFDD)' => 281_079,
49
- 'Europa Plus–Twój Ruch (ALDE)' => 252_779,
50
- 'Polska Razem (ECR)' => 223_733,
51
- 'Ruch Narodowy (—)' => 98_626,
52
- 'Partia Zieloni (Greens/EFA)' => 22_481,
53
- 'Demokracja Bezpośrednia (—)' => 16_222,
54
- 'Samoobrona (—)' => 2_729 }
55
- seats = Sapor::EuropeanUnion27Poland.instance.seats(results)
56
- expect(seats['Platforma Obywatelska (EPP)']).to eq(19 + 1)
57
- expect(seats['Prawo i Sprawiedliwość (ECR)']).to eq(19)
58
- expect(seats['Sojusz Lewicy Demokratycznej–Unia Pracy (S&D)']).to eq(5)
59
- expect(seats['Kongres Nowej Prawicy (ENF)']).to eq(4)
60
- expect(seats['Polskie Stronnictwo Ludowe (EPP)']).to eq(4)
61
- expect(seats['Solidarna Polska Zbigniewa Ziobro (EFDD)']).to eq(0)
62
- expect(seats['Europa Plus–Twój Ruch (ALDE)']).to eq(0)
63
- expect(seats['Polska Razem (ECR)']).to eq(0)
64
- expect(seats['Ruch Narodowy (—)']).to eq(0)
65
- expect(seats['Partia Zieloni (Greens/EFA)']).to eq(0)
66
- expect(seats['Demokracja Bezpośrednia (—)']).to eq(0)
67
- expect(seats['Samoobrona (—)']).to eq(0)
68
- end
69
- end
@@ -1,130 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Statistical Analysis of Polling Results (SAPoR)
4
- # Copyright (C) 2020 Filip van Laenen <f.a.vanlaenen@ieee.org>
5
- #
6
- # This file is part of SAPoR.
7
- #
8
- # SAPoR is free software: you can redistribute it and/or modify it under the
9
- # terms of the GNU General Public License as published by the Free Software
10
- # Foundation, either version 3 of the License, or (at your option) any later
11
- # version.
12
- #
13
- # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
14
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
- # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
- #
17
- # You can find a copy of the GNU General Public License in /doc/gpl.txt
18
- #
19
-
20
- require 'spec_helper'
21
-
22
- describe Sapor::EuropeanUnion27Spain, '#area_code' do
23
- it 'returns EU27[ES] as the area code' do
24
- expect(Sapor::EuropeanUnion27Spain.instance.area_code).to \
25
- eq('EU27[ES]')
26
- end
27
- end
28
-
29
- describe Sapor::EuropeanUnion27Spain, '#no_of_seats' do
30
- it 'returns 59 as the number of seats' do
31
- expect(Sapor::EuropeanUnion27Spain.instance.no_of_seats).to eq(59)
32
- end
33
- end
34
-
35
- describe Sapor::EuropeanUnion27Spain, '#population_size' do
36
- it 'returns a population size of 22,410,049' do
37
- expect(Sapor::EuropeanUnion27Spain.instance.population_size).to \
38
- eq(22_410_049)
39
- end
40
- end
41
-
42
- describe Sapor::EuropeanUnion27Spain, '#seats' do
43
- it 'calculates the number of seats using the votes of the 2014 election' do
44
- results = { 'Partido Popular (EPP)' => 4_098_339,
45
- 'Partido Socialista Obrero Español (S&D)' => 3_614_232,
46
- 'La Izquierda Plural (GUE/NGL)' => 1_575_308,
47
- 'Podemos (GUE/NGL)' => 1_253_837,
48
- 'Unión Progreso y Democracia (ALDE)' => 1_022_232,
49
- 'Coalición por Europa (ALDE)' => 851_971,
50
- 'L’Esquerra pel Dret a Decidir (Greens/EFA)' => 630_072,
51
- 'Ciudadanos–Partido de la Ciudadanía (ALDE)' => 497_146,
52
- 'Los Pueblos Deciden (GUE/NGL)' => 326_464,
53
- 'Primavera Europea (Greens/EFA)' => 302_266,
54
- 'Vox (ECR)' => 246_833,
55
- 'Partido Animalista Contra el Maltrato Animal (—)' => 177_499,
56
- 'Escaños en Blanco (—)' => 115_682,
57
- 'Movimiento de Renovación Democrática de la Ciudadanía (—)' => \
58
- 105_666,
59
- 'Partido X (—)' => 100_561,
60
- 'Partido Andalucista (Greens/EFA)' => 49_523,
61
- 'Confederación Pirata (—)' => 38_690,
62
- 'Foro de Ciudadanos (—)' => 32_962,
63
- 'Agrupación de Electores de Discapacitados y Enfermedades' \
64
- ' Raras (—)' => 32_833,
65
- 'Recortes Cero (—)' => 30_827,
66
- 'Partido Comunista de los Pueblos de España (—)' => 29_324,
67
- 'Iniciativa Feminista (—)' => 23_140,
68
- 'Falange Española de las JONS (—)' => 21_687,
69
- 'Ciudadanos Libres Unidos (—)' => 18_287,
70
- 'Impulso Social (—)' => 17_879,
71
- 'La España en Marcha (—)' => 17_035,
72
- 'Partido Humanista (—)' => 14_896,
73
- 'Democracia Nacional (—)' => 13_079,
74
- 'Proyecto Europa (—)' => 11_502,
75
- 'Partido da Terra (—)' => 9_940,
76
- 'Partido de la Libertad Individual (—)' => 9_670,
77
- 'Movimiento Social Republicano (—)' => 8_909,
78
- 'Extremadura Unida (—)' => 8_821,
79
- 'Alternativa Republicana (—)' => 8_593,
80
- 'Por la República, Por la Ruptura con la Unión Europea (—)' => \
81
- 8_309,
82
- 'Solidaridad y Autogestión Internacionalista (—)' => 6_929,
83
- 'Salamanca-Zamora-León (—)' => 6_759,
84
- 'Extremeños por Europa Coalición electoral (—)' => 5_967,
85
- 'Movimiento Corriente Roja (—)' => 4_980 }
86
- seats = Sapor::EuropeanUnion27Spain.instance.seats(results)
87
- expect(seats['Partido Popular (EPP)']).to eq(16 + 2)
88
- expect(seats['Partido Socialista Obrero Español (S&D)']).to eq(14 + 2)
89
- expect(seats['La Izquierda Plural (GUE/NGL)']).to eq(6)
90
- expect(seats['Podemos (GUE/NGL)']).to eq(5)
91
- expect(seats['Unión Progreso y Democracia (ALDE)']).to eq(4)
92
- expect(seats['Coalición por Europa (ALDE)']).to eq(3)
93
- expect(seats['L’Esquerra pel Dret a Decidir (Greens/EFA)']).to eq(2)
94
- expect(seats['Ciudadanos–Partido de la Ciudadanía (ALDE)']).to eq(2)
95
- expect(seats['Los Pueblos Deciden (GUE/NGL)']).to eq(1)
96
- expect(seats['Primavera Europea (Greens/EFA)']).to eq(1)
97
- expect(seats['Vox (ECR)']).to eq(0 + 1)
98
- expect(seats['Partido Animalista Contra el Maltrato Animal (—)']).to eq(0)
99
- expect(seats['Escaños en Blanco (—)']).to eq(0)
100
- expect(seats['Movimiento de Renovación Democrática de la Ciudadanía (—)']) \
101
- .to eq(0)
102
- expect(seats['Partido X (—)']).to eq(0)
103
- expect(seats['Partido Andalucista (Greens/EFA)']).to eq(0)
104
- expect(seats['Confederación Pirata (—)']).to eq(0)
105
- expect(seats['Foro de Ciudadanos (—)']).to eq(0)
106
- expect(seats['Agrupación de Electores de Discapacitados y Enfermedades' \
107
- ' Raras (—)']).to eq(0)
108
- expect(seats['Recortes Cero (—)']).to eq(0)
109
- expect(seats['Partido Comunista de los Pueblos de España (—)']).to eq(0)
110
- expect(seats['Iniciativa Feminista (—)']).to eq(0)
111
- expect(seats['Falange Española de las JONS (—)']).to eq(0)
112
- expect(seats['Ciudadanos Libres Unidos (—)']).to eq(0)
113
- expect(seats['Impulso Social (—)']).to eq(0)
114
- expect(seats['La España en Marcha (—)']).to eq(0)
115
- expect(seats['Partido Humanista (—)']).to eq(0)
116
- expect(seats['Democracia Nacional (—)']).to eq(0)
117
- expect(seats['Proyecto Europa (—)']).to eq(0)
118
- expect(seats['Partido da Terra (—)']).to eq(0)
119
- expect(seats['Partido de la Libertad Individual (—)']).to eq(0)
120
- expect(seats['Movimiento Social Republicano (—)']).to eq(0)
121
- expect(seats['Extremadura Unida (—)']).to eq(0)
122
- expect(seats['Alternativa Republicana (—)']).to eq(0)
123
- expect(seats['Por la República, Por la Ruptura con la Unión Europea (—)']) \
124
- .to eq(0)
125
- expect(seats['Solidaridad y Autogestión Internacionalista (—)']).to eq(0)
126
- expect(seats['Salamanca-Zamora-León (—)']).to eq(0)
127
- expect(seats['Extremeños por Europa Coalición electoral (—)']).to eq(0)
128
- expect(seats['Movimiento Corriente Roja (—)']).to eq(0)
129
- end
130
- end