sapor 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sapor/poll.rb +0 -3
- data/lib/sapor/regional_data/european_union_romania.rb +2 -2
- data/lib/sapor/regional_data/european_union_slovakia.rb +3 -4
- data/lib/sapor/regional_data/european_union_sweden.rb +2 -2
- data/lib/sapor.rb +0 -3
- data/sapor.gemspec +1 -1
- data/spec/unit/european_union_romania_spec.rb +3 -3
- data/spec/unit/european_union_slovakia_spec.rb +5 -5
- data/spec/unit/european_union_sweden_spec.rb +3 -3
- metadata +2 -11
- data/lib/sapor/regional_data/european_union_27_romania.rb +0 -78
- data/lib/sapor/regional_data/european_union_27_slovakia.rb +0 -80
- data/lib/sapor/regional_data/european_union_27_sweden.rb +0 -76
- data/spec/unit/european_union_27_romania_spec.rb +0 -67
- data/spec/unit/european_union_27_slovakia_spec.rb +0 -111
- data/spec/unit/european_union_27_sweden_spec.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8625b2a87f1061e59193db40609ac5a8d9aa44e2d15e5a2acfbdae7d2d04b98e
|
4
|
+
data.tar.gz: 83e895510cc3bdc9006e2d521eef877f1d5d6d571c74d5c94e2cd1a4ee1241ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6819a08a22929a1ce96715fb093af077741b72da2c39759a826ace687d5448467fee51da521331ef769674bc2a96d3666d76cdda40767a81cf9139d2ef6b955
|
7
|
+
data.tar.gz: 3a0bc6ffe7f0e4c7e94d92beb42e05da334642559fbfb1bc1553482d1c85600d379bc12b5cfee40795efd6fbc996f1084b8dc41f66441931dc24f97c399a8bd9
|
data/lib/sapor/poll.rb
CHANGED
@@ -46,10 +46,7 @@ module Sapor
|
|
46
46
|
EuropeanUnion27Italy.instance,
|
47
47
|
EuropeanUnion27Netherlands.instance,
|
48
48
|
EuropeanUnion27Poland.instance,
|
49
|
-
EuropeanUnion27Romania.instance,
|
50
|
-
EuropeanUnion27Slovakia.instance,
|
51
49
|
EuropeanUnion27Spain.instance,
|
52
|
-
EuropeanUnion27Sweden.instance,
|
53
50
|
EuropeanUnionAustria.instance,
|
54
51
|
EuropeanUnionBulgaria.instance,
|
55
52
|
EuropeanUnionCroatia.instance,
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
module Sapor
|
21
21
|
#
|
22
|
-
# The regional data for the European Union:
|
22
|
+
# The regional data for the European Union: Romania.
|
23
23
|
#
|
24
24
|
class EuropeanUnionRomania < Area
|
25
25
|
include Singleton
|
@@ -56,7 +56,7 @@ module Sapor
|
|
56
56
|
['Partidul Social Democrat (S&D)',
|
57
57
|
'PRO România (S&D)']].freeze
|
58
58
|
|
59
|
-
NO_OF_SEATS =
|
59
|
+
NO_OF_SEATS = 33
|
60
60
|
|
61
61
|
# Voter turnout on 26 May 2019
|
62
62
|
# Source: Web page with the official results of the elections of 26 May
|
@@ -45,7 +45,7 @@ module Sapor
|
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
48
|
-
|
48
|
+
|
49
49
|
COALITIONS = [['Dobrá voľba (*)', 'VLASŤ (*)'],
|
50
50
|
['Kotleba–Ľudová strana Naše Slovensko (NI)'],
|
51
51
|
['Kresťanskodemokratické hnutie (EPP)', 'MOST–HÍD (EPP)',
|
@@ -58,7 +58,7 @@ module Sapor
|
|
58
58
|
['SME RODINA (ID)'],
|
59
59
|
['SMER–sociálna demokracia (S&D)']].freeze
|
60
60
|
|
61
|
-
NO_OF_SEATS =
|
61
|
+
NO_OF_SEATS = 14
|
62
62
|
|
63
63
|
# Voter turnout on 25 May 2019
|
64
64
|
# Source: Web page with the official results of the elections of 25 May
|
@@ -72,8 +72,7 @@ module Sapor
|
|
72
72
|
if @electoral_system.nil?
|
73
73
|
@electoral_system = LargestRemainder.new(NO_OF_SEATS,
|
74
74
|
HagenbachBischoffQuota,
|
75
|
-
THRESHOLD,
|
76
|
-
false, 0, false)
|
75
|
+
THRESHOLD, false, 0, false)
|
77
76
|
end
|
78
77
|
@electoral_system
|
79
78
|
end
|
@@ -54,7 +54,7 @@ module Sapor
|
|
54
54
|
['Sverigedemokraterna (ECR)'],
|
55
55
|
['Vänsterpartiet (GUE/NGL)']].freeze
|
56
56
|
|
57
|
-
NO_OF_SEATS =
|
57
|
+
NO_OF_SEATS = 21
|
58
58
|
|
59
59
|
# Voter turnout on 26 May 2019
|
60
60
|
# Source: Web page with the official results of the elections of 26 May
|
@@ -67,7 +67,7 @@ module Sapor
|
|
67
67
|
def electoral_system
|
68
68
|
if @electoral_system.nil?
|
69
69
|
@electoral_system = SingleDistrictProportional.new(
|
70
|
-
NO_OF_SEATS,
|
70
|
+
NO_OF_SEATS, SainteLague12Denominators, THRESHOLD
|
71
71
|
)
|
72
72
|
end
|
73
73
|
@electoral_system
|
data/lib/sapor.rb
CHANGED
@@ -72,10 +72,7 @@ require 'sapor/regional_data/european_union_27_ireland_with_ia'
|
|
72
72
|
require 'sapor/regional_data/european_union_27_italy'
|
73
73
|
require 'sapor/regional_data/european_union_27_netherlands'
|
74
74
|
require 'sapor/regional_data/european_union_27_poland'
|
75
|
-
require 'sapor/regional_data/european_union_27_romania'
|
76
|
-
require 'sapor/regional_data/european_union_27_slovakia'
|
77
75
|
require 'sapor/regional_data/european_union_27_spain'
|
78
|
-
require 'sapor/regional_data/european_union_27_sweden'
|
79
76
|
require 'sapor/regional_data/european_union_austria'
|
80
77
|
require 'sapor/regional_data/european_union_bulgaria'
|
81
78
|
require 'sapor/regional_data/european_union_croatia'
|
data/sapor.gemspec
CHANGED
@@ -26,8 +26,8 @@ describe Sapor::EuropeanUnionRomania, '#area_code' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe Sapor::EuropeanUnionRomania, '#no_of_seats' do
|
29
|
-
it 'returns
|
30
|
-
expect(Sapor::EuropeanUnionRomania.instance.no_of_seats).to eq(
|
29
|
+
it 'returns 33 as the number of seats' do
|
30
|
+
expect(Sapor::EuropeanUnionRomania.instance.no_of_seats).to eq(33)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -51,7 +51,7 @@ describe Sapor::EuropeanUnionRomania, '#seats' do
|
|
51
51
|
'Forța Civică (EPP)' => 145_181,
|
52
52
|
'Partidul Ecologist Român (—)' => 64_232 }
|
53
53
|
seats = Sapor::EuropeanUnionRomania.instance.seats(results)
|
54
|
-
expect(seats['Uniunea Social Democrată (S&D)']).to eq(15)
|
54
|
+
expect(seats['Uniunea Social Democrată (S&D)']).to eq(15 + 1)
|
55
55
|
# Uniunea Social Democrata got in reality the extra seat from Mircea Diaconu
|
56
56
|
expect(seats['Partidul Național Liberal (ALDE)']).to eq(6)
|
57
57
|
expect(seats['Partidul Democrat Liberal (EPP)']).to eq(5)
|
@@ -26,8 +26,8 @@ describe Sapor::EuropeanUnionSlovakia, '#area_code' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe Sapor::EuropeanUnionSlovakia, '#no_of_seats' do
|
29
|
-
it 'returns
|
30
|
-
expect(Sapor::EuropeanUnionSlovakia.instance.no_of_seats).to eq(
|
29
|
+
it 'returns 14 as the number of seats' do
|
30
|
+
expect(Sapor::EuropeanUnionSlovakia.instance.no_of_seats).to eq(14)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -74,10 +74,10 @@ describe Sapor::EuropeanUnionSlovakia, '#seats' do
|
|
74
74
|
' Kereszténydemokrata Szövetség (Greens/EFA)' => 1_170,
|
75
75
|
'Nový parlament (—)' => 900 }
|
76
76
|
seats = Sapor::EuropeanUnionSlovakia.instance.seats(results)
|
77
|
-
expect(seats['SMER–sociálna demokracia (S&D)']).to eq(4)
|
78
|
-
expect(seats['Kresťanskodemokratické hnutie (EPP)']).to eq(2)
|
77
|
+
expect(seats['SMER–sociálna demokracia (S&D)']).to eq(4 + 1)
|
78
|
+
expect(seats['Kresťanskodemokratické hnutie (EPP)']).to eq(2 + 1)
|
79
79
|
expect(seats['Slovenská demokratická a kresťanská únia–Demokratická' \
|
80
|
-
' strana (EPP)']).to eq(2)
|
80
|
+
' strana (EPP)']).to eq(2 - 1)
|
81
81
|
expect(seats['OBYČAJNÍ ĽUDIA a nezávislé osobnosti (ECR)']).to eq(1)
|
82
82
|
expect(seats['NOVA–Konzervatívni demokrati Slovenska–Občianska' \
|
83
83
|
' konzervatívna strana (ECR)']).to eq(1)
|
@@ -26,8 +26,8 @@ describe Sapor::EuropeanUnionSweden, '#area_code' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe Sapor::EuropeanUnionSweden, '#no_of_seats' do
|
29
|
-
it 'returns
|
30
|
-
expect(Sapor::EuropeanUnionSweden.instance.no_of_seats).to eq(
|
29
|
+
it 'returns 21 as the number of seats' do
|
30
|
+
expect(Sapor::EuropeanUnionSweden.instance.no_of_seats).to eq(21)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -63,7 +63,7 @@ describe Sapor::EuropeanUnionSweden, '#seats' do
|
|
63
63
|
' fred, kärlek och lyckan (—)' => 11,
|
64
64
|
'Republicans right (—)' => 9 }
|
65
65
|
seats = Sapor::EuropeanUnionSweden.instance.seats(results)
|
66
|
-
expect(seats['Sveriges socialdemokratiska arbetareparti (S&D)']).to eq(5)
|
66
|
+
expect(seats['Sveriges socialdemokratiska arbetareparti (S&D)']).to eq(5 + 1)
|
67
67
|
expect(seats['Miljöpartiet de gröna (Greens/EFA)']).to eq(4)
|
68
68
|
expect(seats['Moderata samlingspartiet (EPP)']).to eq(3)
|
69
69
|
expect(seats['Liberalerna (ALDE)']).to eq(2)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filip van Laenen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: SAPoR
|
14
14
|
email:
|
@@ -129,10 +129,7 @@ files:
|
|
129
129
|
- lib/sapor/regional_data/european_union_27_italy.rb
|
130
130
|
- lib/sapor/regional_data/european_union_27_netherlands.rb
|
131
131
|
- lib/sapor/regional_data/european_union_27_poland.rb
|
132
|
-
- lib/sapor/regional_data/european_union_27_romania.rb
|
133
|
-
- lib/sapor/regional_data/european_union_27_slovakia.rb
|
134
132
|
- lib/sapor/regional_data/european_union_27_spain.rb
|
135
|
-
- lib/sapor/regional_data/european_union_27_sweden.rb
|
136
133
|
- lib/sapor/regional_data/european_union_austria.rb
|
137
134
|
- lib/sapor/regional_data/european_union_bulgaria.rb
|
138
135
|
- lib/sapor/regional_data/european_union_croatia.rb
|
@@ -278,10 +275,7 @@ files:
|
|
278
275
|
- spec/unit/european_union_27_italy_spec.rb
|
279
276
|
- spec/unit/european_union_27_netherlands_spec.rb
|
280
277
|
- spec/unit/european_union_27_poland_spec.rb
|
281
|
-
- spec/unit/european_union_27_romania_spec.rb
|
282
|
-
- spec/unit/european_union_27_slovakia_spec.rb
|
283
278
|
- spec/unit/european_union_27_spain_spec.rb
|
284
|
-
- spec/unit/european_union_27_sweden_spec.rb
|
285
279
|
- spec/unit/european_union_austria_spec.rb
|
286
280
|
- spec/unit/european_union_bulgaria_spec.rb
|
287
281
|
- spec/unit/european_union_croatia_spec.rb
|
@@ -418,10 +412,7 @@ test_files:
|
|
418
412
|
- spec/unit/european_union_27_italy_spec.rb
|
419
413
|
- spec/unit/european_union_27_netherlands_spec.rb
|
420
414
|
- spec/unit/european_union_27_poland_spec.rb
|
421
|
-
- spec/unit/european_union_27_romania_spec.rb
|
422
|
-
- spec/unit/european_union_27_slovakia_spec.rb
|
423
415
|
- spec/unit/european_union_27_spain_spec.rb
|
424
|
-
- spec/unit/european_union_27_sweden_spec.rb
|
425
416
|
- spec/unit/european_union_austria_spec.rb
|
426
417
|
- spec/unit/european_union_bulgaria_spec.rb
|
427
418
|
- spec/unit/european_union_croatia_spec.rb
|
@@ -1,78 +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
|
-
module Sapor
|
21
|
-
#
|
22
|
-
# The regional data for the European Union 27: Poland.
|
23
|
-
#
|
24
|
-
class EuropeanUnion27Romania < Area
|
25
|
-
include Singleton
|
26
|
-
|
27
|
-
def area_code
|
28
|
-
'EU27[RO]'
|
29
|
-
end
|
30
|
-
|
31
|
-
def coalitions
|
32
|
-
COALITIONS
|
33
|
-
end
|
34
|
-
|
35
|
-
def no_of_seats
|
36
|
-
NO_OF_SEATS
|
37
|
-
end
|
38
|
-
|
39
|
-
def population_size
|
40
|
-
POPULATION_SIZE
|
41
|
-
end
|
42
|
-
|
43
|
-
def seats(simulation)
|
44
|
-
electoral_system.project(simulation)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
COALITIONS = [['Alianța 2020 USR-PLUS (RE)',
|
50
|
-
'Partidul Libertății, Unității și Solidarității (RE)',
|
51
|
-
'Uniunea Salvați România (RE)'],
|
52
|
-
['Partidul Alianța Liberalilor și Democraților (*)'],
|
53
|
-
['Partidul Mișcarea Populară (EPP)',
|
54
|
-
'Partidul Național Liberal (EPP)',
|
55
|
-
'Uniunea Democrată Maghiară din România (EPP)'],
|
56
|
-
['Partidul Social Democrat (S&D)',
|
57
|
-
'PRO România (S&D)']].freeze
|
58
|
-
|
59
|
-
NO_OF_SEATS = 33
|
60
|
-
|
61
|
-
# Voter turnout on 26 May 2019
|
62
|
-
# Source: Web page with the official results of the elections of 26 May
|
63
|
-
# 2019, downloaded on 28 July 2019,
|
64
|
-
# https://en.wikipedia.org/wiki/2019_European_Parliament_election_in_Romania
|
65
|
-
POPULATION_SIZE = 9_352_472
|
66
|
-
|
67
|
-
THRESHOLD = 0.05
|
68
|
-
|
69
|
-
def electoral_system
|
70
|
-
if @electoral_system.nil?
|
71
|
-
@electoral_system = SingleDistrictProportional.new(NO_OF_SEATS,
|
72
|
-
DhondtDenominators,
|
73
|
-
THRESHOLD)
|
74
|
-
end
|
75
|
-
@electoral_system
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,80 +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
|
-
module Sapor
|
21
|
-
#
|
22
|
-
# The regional data for the European Union (27): Slovakia.
|
23
|
-
#
|
24
|
-
class EuropeanUnion27Slovakia < Area
|
25
|
-
include Singleton
|
26
|
-
|
27
|
-
def area_code
|
28
|
-
'EU27[SK]'
|
29
|
-
end
|
30
|
-
|
31
|
-
def coalitions
|
32
|
-
COALITIONS
|
33
|
-
end
|
34
|
-
|
35
|
-
def no_of_seats
|
36
|
-
NO_OF_SEATS
|
37
|
-
end
|
38
|
-
|
39
|
-
def population_size
|
40
|
-
POPULATION_SIZE
|
41
|
-
end
|
42
|
-
|
43
|
-
def seats(simulation)
|
44
|
-
electoral_system.project(simulation)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
COALITIONS = [['Dobrá voľba (*)', 'VLASŤ (*)'],
|
50
|
-
['Kotleba–Ľudová strana Naše Slovensko (NI)'],
|
51
|
-
['Kresťanskodemokratické hnutie (EPP)', 'MOST–HÍD (EPP)',
|
52
|
-
'OBYČAJNÍ ĽUDIA a nezávislé osobnosti (EPP)',
|
53
|
-
'Strana maďarskej koalície–Magyar Koalíció Pártja (EPP)',
|
54
|
-
'Za ľudí (EPP)'],
|
55
|
-
['NOVA (ECR)', 'Sloboda a Solidarita (ECR)',
|
56
|
-
'Slovenská národná strana (ECR)'],
|
57
|
-
['Progresívne Slovensko–SPOLU–Občianska Demokracia (RE)'],
|
58
|
-
['SME RODINA (ID)'],
|
59
|
-
['SMER–sociálna demokracia (S&D)']].freeze
|
60
|
-
|
61
|
-
NO_OF_SEATS = 14
|
62
|
-
|
63
|
-
# Voter turnout on 25 May 2019
|
64
|
-
# Source: Web page with the official results of the elections of 25 May
|
65
|
-
# 2019, downloaded on 24 June 2019,
|
66
|
-
# https://en.wikipedia.org/wiki/2019_European_Parliament_election_in_Slovakia
|
67
|
-
POPULATION_SIZE = 1_007_398
|
68
|
-
|
69
|
-
THRESHOLD = 0.05
|
70
|
-
|
71
|
-
def electoral_system
|
72
|
-
if @electoral_system.nil?
|
73
|
-
@electoral_system = LargestRemainder.new(NO_OF_SEATS,
|
74
|
-
HagenbachBischoffQuota,
|
75
|
-
THRESHOLD)
|
76
|
-
end
|
77
|
-
@electoral_system
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,76 +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
|
-
module Sapor
|
21
|
-
#
|
22
|
-
# The regional data for the European Union (27): Sweden.
|
23
|
-
#
|
24
|
-
class EuropeanUnion27Sweden < Area
|
25
|
-
include Singleton
|
26
|
-
|
27
|
-
def area_code
|
28
|
-
'EU27[SE]'
|
29
|
-
end
|
30
|
-
|
31
|
-
def coalitions
|
32
|
-
COALITIONS
|
33
|
-
end
|
34
|
-
|
35
|
-
def no_of_seats
|
36
|
-
NO_OF_SEATS
|
37
|
-
end
|
38
|
-
|
39
|
-
def population_size
|
40
|
-
POPULATION_SIZE
|
41
|
-
end
|
42
|
-
|
43
|
-
def seats(simulation)
|
44
|
-
electoral_system.project(simulation)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
COALITIONS = [['Centerpartiet (RE)', 'Liberalerna (RE)'],
|
50
|
-
['Feministiskt initiativ (S&D)',
|
51
|
-
'Sveriges socialdemokratiska arbetareparti (S&D)'],
|
52
|
-
['Kristdemokraterna (EPP)', 'Moderata samlingspartiet (EPP)'],
|
53
|
-
['Miljöpartiet de gröna (Greens/EFA)'],
|
54
|
-
['Sverigedemokraterna (ECR)'],
|
55
|
-
['Vänsterpartiet (GUE/NGL)']].freeze
|
56
|
-
|
57
|
-
NO_OF_SEATS = 21
|
58
|
-
|
59
|
-
# Voter turnout on 26 May 2019
|
60
|
-
# Source: Web page with the official results of the elections of 26 May
|
61
|
-
# 2019, downloaded on 15 June 2019,
|
62
|
-
# https://de.wikipedia.org/wiki/Europawahl_in_Schweden_2019
|
63
|
-
POPULATION_SIZE = 4_151_470
|
64
|
-
|
65
|
-
THRESHOLD = 0.04
|
66
|
-
|
67
|
-
def electoral_system
|
68
|
-
if @electoral_system.nil?
|
69
|
-
@electoral_system = SingleDistrictProportional.new(
|
70
|
-
NO_OF_SEATS, SainteLague12Denominators, THRESHOLD
|
71
|
-
)
|
72
|
-
end
|
73
|
-
@electoral_system
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,67 +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::EuropeanUnion27Romania, '#area_code' do
|
23
|
-
it 'returns EU27[RO] as the area code' do
|
24
|
-
expect(Sapor::EuropeanUnion27Romania.instance.area_code).to eq('EU27[RO]')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Sapor::EuropeanUnion27Romania, '#no_of_seats' do
|
29
|
-
it 'returns 33 as the number of seats' do
|
30
|
-
expect(Sapor::EuropeanUnion27Romania.instance.no_of_seats).to eq(33)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe Sapor::EuropeanUnion27Romania, '#population_size' do
|
35
|
-
it 'returns a population size of 9,352,472' do
|
36
|
-
expect(Sapor::EuropeanUnion27Romania.instance.population_size).to \
|
37
|
-
eq(9_352_472)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Sapor::EuropeanUnion27Romania, '#seats' do
|
42
|
-
it 'calculates the number of seats for the election of 2014' do
|
43
|
-
results = { 'Uniunea Social Democrată (S&D)' => 2_093_237,
|
44
|
-
'Partidul Național Liberal (ALDE)' => 835_531,
|
45
|
-
'Partidul Democrat Liberal (EPP)' => 680_853,
|
46
|
-
'Mircea Diaconu (ALDE)' => 379_582,
|
47
|
-
'Uniunea Democrată Maghiară din România (EPP)' => 350_689,
|
48
|
-
'Partidul Mișcarea Populară (EPP)' => 345_973,
|
49
|
-
'Partidul Poporului–Dan Diaconescu (—)' => 204_310,
|
50
|
-
'Partidul România Mare (—)' => 150_484,
|
51
|
-
'Forța Civică (EPP)' => 145_181,
|
52
|
-
'Partidul Ecologist Român (—)' => 64_232 }
|
53
|
-
seats = Sapor::EuropeanUnion27Romania.instance.seats(results)
|
54
|
-
expect(seats['Uniunea Social Democrată (S&D)']).to eq(15 + 1)
|
55
|
-
# Uniunea Social Democrata got in reality the extra seat from Mircea Diaconu
|
56
|
-
expect(seats['Partidul Național Liberal (ALDE)']).to eq(6)
|
57
|
-
expect(seats['Partidul Democrat Liberal (EPP)']).to eq(5)
|
58
|
-
expect(seats['Partidul Democrat Liberal (EPP)']).to eq(5)
|
59
|
-
expect(seats['Mircea Diaconu (ALDE)']).to eq(2) # Only one candidate
|
60
|
-
expect(seats['Uniunea Democrată Maghiară din România (EPP)']).to eq(2)
|
61
|
-
expect(seats['Partidul Mișcarea Populară (EPP)']).to eq(2)
|
62
|
-
expect(seats['Partidul Poporului–Dan Diaconescu (—)']).to eq(0)
|
63
|
-
expect(seats['Partidul România Mare (—)']).to eq(0)
|
64
|
-
expect(seats['Forța Civică (EPP)']).to eq(0)
|
65
|
-
expect(seats['Partidul Ecologist Român (—)']).to eq(0)
|
66
|
-
end
|
67
|
-
end
|
@@ -1,111 +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::EuropeanUnion27Slovakia, '#area_code' do
|
23
|
-
it 'returns EU27[SK] as the area code' do
|
24
|
-
expect(Sapor::EuropeanUnion27Slovakia.instance.area_code).to eq('EU27[SK]')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Sapor::EuropeanUnion27Slovakia, '#no_of_seats' do
|
29
|
-
it 'returns 14 as the number of seats' do
|
30
|
-
expect(Sapor::EuropeanUnion27Slovakia.instance.no_of_seats).to eq(14)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe Sapor::EuropeanUnion27Slovakia, '#population_size' do
|
35
|
-
it 'returns a population size of 1,007,398' do
|
36
|
-
expect(Sapor::EuropeanUnion27Slovakia.instance.population_size).to \
|
37
|
-
eq(1_007_398)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Sapor::EuropeanUnion27Slovakia, '#seats' do
|
42
|
-
it 'calculates the number of seats for the election of 2014' do
|
43
|
-
results = { 'SMER–sociálna demokracia (S&D)' => 135_089,
|
44
|
-
'Kresťanskodemokratické hnutie (EPP)' => 74_108,
|
45
|
-
'Slovenská demokratická a kresťanská únia–Demokratická' \
|
46
|
-
' strana (EPP)' => 43_467,
|
47
|
-
'OBYČAJNÍ ĽUDIA a nezávislé osobnosti (ECR)' => 41_829,
|
48
|
-
'NOVA–Konzervatívni demokrati Slovenska–Občianska' \
|
49
|
-
' konzervatívna strana (ECR)' => 38_316,
|
50
|
-
'Sloboda a Solidarita (ALDE)' => 37_376,
|
51
|
-
'Strana maďarskej koalície–Magyar Koalíció Pártja (EPP)' \
|
52
|
-
=> 36_629,
|
53
|
-
'MOST–HÍD (EPP)' => 32_708,
|
54
|
-
'Strana TIP (—)' => 20_730,
|
55
|
-
'Slovenská národná strana (EFDD)' => 20_244,
|
56
|
-
'Ľudová strana Naše Slovensko (NI)' => 9_749,
|
57
|
-
'PRÁVO A SPRAVODLIVOSŤ (—)' => 9_322,
|
58
|
-
'Komunistická strana Slovenska (GUE/NGL)' => 8_510,
|
59
|
-
'Strana demokratického Slovenska (ALDE)' => 8_378,
|
60
|
-
'Národ a Spravodlivosť–naša strana (—)' => 7_763,
|
61
|
-
'Magnificat Slovakia (—)' => 6_646,
|
62
|
-
'Európska demokratická strana (ALDE)' => 3_739,
|
63
|
-
'Kresťanská SLOVENSKÁ NÁRODNÁ STRANA (—)' => 3_631,
|
64
|
-
'Strana moderného Slovenska (—)' => 2_851,
|
65
|
-
'ÚSVIT (—)' => 2_773,
|
66
|
-
'7 STATOČNÝCH REGIONÁLNA STRANA SLOVENSKA (—)' => 2_696,
|
67
|
-
'Strana zelených (Greens/EFA)' => 2_623,
|
68
|
-
'Slovenská ľudová strana (—)' => 2_590,
|
69
|
-
'PRIAMA DEMOKRACIA–Kresťanská ľudová strana (ALDE)' => 2_405,
|
70
|
-
'VZDOR–strana práce (—)' => 1_769,
|
71
|
-
'Strana občianskej ľavice (—)' => 1_311,
|
72
|
-
'DEMOKRATICKÁ OBČIANSKA STRANA (—)' => 1_273,
|
73
|
-
'Maďarská kresťanskodemokratická aliancia–Magyar' \
|
74
|
-
' Kereszténydemokrata Szövetség (Greens/EFA)' => 1_170,
|
75
|
-
'Nový parlament (—)' => 900 }
|
76
|
-
seats = Sapor::EuropeanUnion27Slovakia.instance.seats(results)
|
77
|
-
expect(seats['SMER–sociálna demokracia (S&D)']).to eq(4 + 1)
|
78
|
-
expect(seats['Kresťanskodemokratické hnutie (EPP)']).to eq(2 + 1)
|
79
|
-
expect(seats['Slovenská demokratická a kresťanská únia–Demokratická' \
|
80
|
-
' strana (EPP)']).to eq(2 - 1)
|
81
|
-
expect(seats['OBYČAJNÍ ĽUDIA a nezávislé osobnosti (ECR)']).to eq(1)
|
82
|
-
expect(seats['NOVA–Konzervatívni demokrati Slovenska–Občianska' \
|
83
|
-
' konzervatívna strana (ECR)']).to eq(1)
|
84
|
-
expect(seats['Sloboda a Solidarita (ALDE)']).to eq(1)
|
85
|
-
expect(seats['Strana maďarskej koalície–Magyar Koalíció Pártja (EPP)']).to \
|
86
|
-
eq(1)
|
87
|
-
expect(seats['MOST–HÍD (EPP)']).to eq(1)
|
88
|
-
expect(seats['Strana TIP (—)']).to eq(0)
|
89
|
-
expect(seats['Slovenská národná strana (EFDD)']).to eq(0)
|
90
|
-
expect(seats['Ľudová strana Naše Slovensko (NI)']).to eq(0)
|
91
|
-
expect(seats['PRÁVO A SPRAVODLIVOSŤ (—)']).to eq(0)
|
92
|
-
expect(seats['Komunistická strana Slovenska (GUE/NGL)']).to eq(0)
|
93
|
-
expect(seats['Strana demokratického Slovenska (ALDE)']).to eq(0)
|
94
|
-
expect(seats['Národ a Spravodlivosť–naša strana (—)']).to eq(0)
|
95
|
-
expect(seats['Magnificat Slovakia (—)']).to eq(0)
|
96
|
-
expect(seats['Európska demokratická strana (ALDE)']).to eq(0)
|
97
|
-
expect(seats['Kresťanská SLOVENSKÁ NÁRODNÁ STRANA (—)']).to eq(0)
|
98
|
-
expect(seats['Strana moderného Slovenska (—)']).to eq(0)
|
99
|
-
expect(seats['ÚSVIT (—)']).to eq(0)
|
100
|
-
expect(seats['7 STATOČNÝCH REGIONÁLNA STRANA SLOVENSKA (—)']).to eq(0)
|
101
|
-
expect(seats['Strana zelených (Greens/EFA)']).to eq(0)
|
102
|
-
expect(seats['Slovenská ľudová strana (—)']).to eq(0)
|
103
|
-
expect(seats['PRIAMA DEMOKRACIA–Kresťanská ľudová strana (ALDE)']).to eq(0)
|
104
|
-
expect(seats['VZDOR–strana práce (—)']).to eq(0)
|
105
|
-
expect(seats['Strana občianskej ľavice (—)']).to eq(0)
|
106
|
-
expect(seats['DEMOKRATICKÁ OBČIANSKA STRANA (—)']).to eq(0)
|
107
|
-
expect(seats['Maďarská kresťanskodemokratická aliancia–Magyar' \
|
108
|
-
' Kereszténydemokrata Szövetség (Greens/EFA)']).to eq(0)
|
109
|
-
expect(seats['Nový parlament (—)']).to eq(0)
|
110
|
-
end
|
111
|
-
end
|
@@ -1,89 +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::EuropeanUnion27Sweden, '#area_code' do
|
23
|
-
it 'returns EU27[SE] as the area code' do
|
24
|
-
expect(Sapor::EuropeanUnion27Sweden.instance.area_code).to eq('EU27[SE]')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe Sapor::EuropeanUnion27Sweden, '#no_of_seats' do
|
29
|
-
it 'returns 21 as the number of seats' do
|
30
|
-
expect(Sapor::EuropeanUnion27Sweden.instance.no_of_seats).to eq(21)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe Sapor::EuropeanUnion27Sweden, '#population_size' do
|
35
|
-
it 'returns a population size of 4,151,470' do
|
36
|
-
expect(Sapor::EuropeanUnion27Sweden.instance.population_size).to \
|
37
|
-
eq(4_151_470)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Sapor::EuropeanUnion27Sweden, '#seats' do
|
42
|
-
it 'calculates the number of seats for the election of 2014' do
|
43
|
-
results = { 'Sveriges socialdemokratiska arbetareparti (S&D)' => 899_074,
|
44
|
-
'Miljöpartiet de gröna (Greens/EFA)' => 572_591,
|
45
|
-
'Moderata samlingspartiet (EPP)' => 507_488,
|
46
|
-
'Liberalerna (ALDE)' => 368_514,
|
47
|
-
'Sverigedemokraterna (EFDD)' => 359_248,
|
48
|
-
'Centerpartiet (ALDE)' => 241_101,
|
49
|
-
'Vänsterpartiet (GUE/NGL)' => 234_272,
|
50
|
-
'Kristdemokraterna (EPP)' => 220_574,
|
51
|
-
'Feministiskt initiativ (S&D)' => 204_005,
|
52
|
-
'Piratpartiet (Greens/EFA)' => 82_763,
|
53
|
-
'Junilistan (GUE/NGL)' => 11_629,
|
54
|
-
'Djurens parti (GUE/NGL)' => 8_773,
|
55
|
-
'Liberala partiet (—)' => 492,
|
56
|
-
'Europeiska arbetarpartiet (—)' => 170,
|
57
|
-
'Sverigesmultidemokrater (—)' => 133,
|
58
|
-
'Sverige ut ur EU–Frihetliga Rättvisepartiet (—)' => 106,
|
59
|
-
'Socialistiska välfärdspartiet (—)' => 86,
|
60
|
-
'Äkta demokrati (—)' => 72,
|
61
|
-
'Sveriges nationella demokratiska parti (—)' => 49,
|
62
|
-
'666 för en EU:s super-state med frihet, jämlikhet, rättvisa,' \
|
63
|
-
' fred, kärlek och lyckan (—)' => 11,
|
64
|
-
'Republicans right (—)' => 9 }
|
65
|
-
seats = Sapor::EuropeanUnion27Sweden.instance.seats(results)
|
66
|
-
expect(seats['Sveriges socialdemokratiska arbetareparti (S&D)']).to eq(5 + 1)
|
67
|
-
expect(seats['Miljöpartiet de gröna (Greens/EFA)']).to eq(4)
|
68
|
-
expect(seats['Moderata samlingspartiet (EPP)']).to eq(3)
|
69
|
-
expect(seats['Liberalerna (ALDE)']).to eq(2)
|
70
|
-
expect(seats['Sverigedemokraterna (EFDD)']).to eq(2)
|
71
|
-
expect(seats['Centerpartiet (ALDE)']).to eq(1)
|
72
|
-
expect(seats['Vänsterpartiet (GUE/NGL)']).to eq(1)
|
73
|
-
expect(seats['Kristdemokraterna (EPP)']).to eq(1)
|
74
|
-
expect(seats['Feministiskt initiativ (S&D)']).to eq(1)
|
75
|
-
expect(seats['Piratpartiet (Greens/EFA)']).to eq(0)
|
76
|
-
expect(seats['Junilistan (GUE/NGL)']).to eq(0)
|
77
|
-
expect(seats['Djurens parti (GUE/NGL)']).to eq(0)
|
78
|
-
expect(seats['Liberala partiet (—)']).to eq(0)
|
79
|
-
expect(seats['Europeiska arbetarpartiet (—)']).to eq(0)
|
80
|
-
expect(seats['Sverigesmultidemokrater (—)']).to eq(0)
|
81
|
-
expect(seats['Sverige ut ur EU–Frihetliga Rättvisepartiet (—)']).to eq(0)
|
82
|
-
expect(seats['Socialistiska välfärdspartiet (—)']).to eq(0)
|
83
|
-
expect(seats['Äkta demokrati (—)']).to eq(0)
|
84
|
-
expect(seats['Sveriges nationella demokratiska parti (—)']).to eq(0)
|
85
|
-
expect(seats['666 för en EU:s super-state med frihet, jämlikhet,' \
|
86
|
-
' rättvisa, fred, kärlek och lyckan (—)']).to eq(0)
|
87
|
-
expect(seats['Republicans right (—)']).to eq(0)
|
88
|
-
end
|
89
|
-
end
|