litexbrl 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +1 -1
- data/TODO.txt +8 -0
- data/bin/1.htm +2 -0
- data/bin/1q.htm +2 -0
- data/bin/ifrs-rev.htm +2 -0
- data/bin/ifrs.htm +2 -0
- data/bin/litexbrl +28 -0
- data/bin/mid.htm +2 -0
- data/bin/minus.htm +2 -0
- data/bin/non-cons.htm +2 -0
- data/bin/rev-non-cons.htm +2 -0
- data/bin/rev.htm +3986 -0
- data/bin/year.htm +2919 -0
- data/lib/litexbrl/tdnet/account_item.rb +111 -0
- data/lib/litexbrl/tdnet/company_attribute.rb +15 -0
- data/lib/litexbrl/tdnet/financial_information.rb +151 -0
- data/lib/litexbrl/tdnet/financial_information2.rb +97 -0
- data/lib/litexbrl/tdnet/results_forecast.rb +102 -0
- data/lib/litexbrl/tdnet/results_forecast2.rb +139 -0
- data/lib/litexbrl/tdnet/results_forecast_attribute.rb +35 -0
- data/lib/litexbrl/tdnet/summary.rb +127 -134
- data/lib/litexbrl/tdnet/summary2.rb +178 -0
- data/lib/litexbrl/tdnet/summary_attribute.rb +60 -0
- data/lib/litexbrl/tdnet.rb +64 -0
- data/lib/litexbrl/utils.rb +29 -35
- data/lib/litexbrl/version.rb +1 -1
- data/lib/litexbrl.rb +1 -1
- data/litexbrl.gemspec +4 -4
- data/spec/data/tdnet/results_forecast/ifrs-cons-2014.xbrl +4 -0
- data/spec/data/tdnet/results_forecast/jp-cons-2012.xbrl +6 -0
- data/spec/data/tdnet/results_forecast/jp-noncons-2014.xbrl +6 -0
- data/spec/data/tdnet/results_forecast/us-cons-2014.xbrl +8 -0
- data/spec/data/tdnet/results_forecast.xbrl +6 -0
- data/spec/data/tdnet/results_forecast2/1q.htm +2 -0
- data/spec/data/tdnet/results_forecast2/2q-4q.htm +2 -0
- data/spec/data/tdnet/results_forecast2/3q.htm +2 -0
- data/spec/data/tdnet/results_forecast2/ifrs-cons-2014.htm +2 -0
- data/spec/data/tdnet/results_forecast2/jp-cons-2014.htm +2 -0
- data/spec/data/tdnet/results_forecast2/jp-noncons-2014.htm +2 -0
- data/spec/data/tdnet/results_forecast2/range.htm +2 -0
- data/spec/data/tdnet/results_forecast2/us-cons-2014.htm +2 -0
- data/spec/data/tdnet/results_forecast2.htm +2 -0
- data/spec/data/tdnet/summary/ifrs-cons-2014-q1.xbrl +2 -0
- data/spec/data/tdnet/summary/ifrs-or-cons-2014-q1.xbrl +2 -0
- data/spec/data/tdnet/summary/ifrs-sa-cons-2014-q1.xbrl +5 -0
- data/spec/data/tdnet/summary/jp-bk-cons-2014-q1.xbrl +2 -0
- data/spec/data/tdnet/summary/jp-cons-2013-q4.xbrl +2 -0
- data/spec/data/tdnet/summary/jp-goprv-cons-2013-q4.xbrl +3 -0
- data/spec/data/tdnet/summary/jp-in-cons-2014-q1.xbrl +2 -0
- data/spec/data/tdnet/summary/jp-nsco-cons-2013-q4.xbrl +3 -0
- data/spec/data/tdnet/summary/jp-oprv-cons-2014-q1.xbrl +3 -0
- data/spec/data/tdnet/summary/jp-oprvsp-cons-2014-q1.xbrl +2 -0
- data/spec/data/tdnet/summary/jp-se-cons-2014-q1.xbrl +3 -0
- data/spec/data/tdnet/summary/us-bnip-cons-2014-q1.xbrl +5 -0
- data/spec/data/tdnet/summary/us-cons-2014-q1.xbrl +24 -0
- data/spec/data/tdnet/summary/us-ibmi-cons-2013-q4.xbrl +10 -0
- data/spec/data/tdnet/summary/us-ifco-cons-2013-q4.xbrl +6 -0
- data/spec/data/tdnet/summary/us-nsoprv-cons-2014-q1.xbrl +3 -0
- data/spec/data/tdnet/summary/us-oi-cons-2014-q1.xbrl +3 -0
- data/spec/data/tdnet/summary/us-oprv-cons-2014-q1.xbrl +3 -0
- data/spec/data/tdnet/summary/us-tr-ibit-cons-2013-q4.xbrl +3 -0
- data/spec/data/tdnet/summary2/ifrs-cons-2013-q4.htm +2 -0
- data/spec/data/tdnet/summary2/jp-cons-2013-q4.htm +2 -0
- data/spec/data/tdnet/summary2/jp-cons-2014-q1.htm +2 -0
- data/spec/data/tdnet/summary2/jp-noncons-2014-q4.htm +2 -0
- data/spec/data/tdnet/summary2/us-cons-2014-q4.htm +2 -0
- data/spec/data/tdnet/summary2.htm +2 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/support/nokogiri_helper.rb +4 -0
- data/spec/tdnet/account_item_spec.rb +57 -0
- data/spec/tdnet/results_forecast2_spec.rb +257 -0
- data/spec/tdnet/results_forecast_attribute_spec.rb +58 -0
- data/spec/tdnet/results_forecast_spec.rb +112 -0
- data/spec/tdnet/summary2_spec.rb +247 -0
- data/spec/tdnet/summary_attribute_spec.rb +92 -0
- data/spec/tdnet/summary_spec.rb +543 -62
- data/spec/tdnet_spec.rb +41 -0
- data/spec/utils_spec.rb +74 -0
- metadata +144 -20
- /data/spec/data/tdnet/summary/{ja-cons-2013-q1.xbrl → jp-cons-2013-q1.xbrl} +0 -0
- /data/spec/data/tdnet/summary/{ja-cons-2013-q2.xbrl → jp-cons-2013-q2.xbrl} +0 -0
- /data/spec/data/tdnet/summary/{ja-cons-2013-q3.xbrl → jp-cons-2013-q3.xbrl} +0 -0
- /data/spec/data/tdnet/summary/{ja-noncons-q1.xbrl → jp-noncons-q1.xbrl} +0 -0
- /data/spec/data/tdnet/{summary/ja-cons-2013-q4.xbrl → summary.xbrl} +0 -0
@@ -0,0 +1,257 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/nokogiri_helper'
|
3
|
+
|
4
|
+
module LiteXBRL
|
5
|
+
module TDnet
|
6
|
+
describe ResultsForecast do
|
7
|
+
include NokogiriHelper
|
8
|
+
|
9
|
+
let(:dir) { File.expand_path '../../data/tdnet/results_forecast2', __FILE__ }
|
10
|
+
|
11
|
+
describe ".find_consolidation" do
|
12
|
+
it "非連結" do
|
13
|
+
consolidation = ResultsForecast2.send(:find_consolidation,
|
14
|
+
doc("#{dir}/jp-noncons-2014.htm"),
|
15
|
+
ResultsForecast2::SEASON_Q4,
|
16
|
+
ResultsForecast2::NET_SALES)
|
17
|
+
expect(consolidation).to eq "NonConsolidated"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe ".read" do
|
22
|
+
context '第2四半期・通期' do
|
23
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/2q-4q.htm") }
|
24
|
+
let(:forecast_q2) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 2 } }
|
25
|
+
let(:forecast_q4) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 4 } }
|
26
|
+
|
27
|
+
it do
|
28
|
+
expect(forecast_q2[:code]).to eq "2379"
|
29
|
+
expect(forecast_q2[:year]).to eq 2015
|
30
|
+
expect(forecast_q2[:month]).to eq 2
|
31
|
+
expect(forecast_q2[:quarter]).to eq 2
|
32
|
+
|
33
|
+
expect(forecast_q2[:previous_forecast_net_sales]).to eq 7320
|
34
|
+
expect(forecast_q2[:previous_forecast_operating_income]).to eq 467
|
35
|
+
expect(forecast_q2[:previous_forecast_ordinary_income]).to eq 462
|
36
|
+
expect(forecast_q2[:previous_forecast_net_income]).to eq 237
|
37
|
+
expect(forecast_q2[:previous_forecast_net_income_per_share]).to eq 21.43
|
38
|
+
|
39
|
+
expect(forecast_q2[:forecast_net_sales]).to eq 8000
|
40
|
+
expect(forecast_q2[:forecast_operating_income]).to eq 746
|
41
|
+
expect(forecast_q2[:forecast_ordinary_income]).to eq 744
|
42
|
+
expect(forecast_q2[:forecast_net_income]).to eq 392
|
43
|
+
expect(forecast_q2[:forecast_net_income_per_share]).to eq 35.49
|
44
|
+
|
45
|
+
expect(forecast_q2[:change_forecast_net_sales]).to eq 0.093
|
46
|
+
expect(forecast_q2[:change_forecast_operating_income]).to eq 0.598
|
47
|
+
expect(forecast_q2[:change_forecast_ordinary_income]).to eq 0.61
|
48
|
+
expect(forecast_q2[:change_forecast_net_income]).to eq 0.658
|
49
|
+
|
50
|
+
expect(forecast_q4[:code]).to eq "2379"
|
51
|
+
expect(forecast_q4[:year]).to eq 2015
|
52
|
+
expect(forecast_q4[:month]).to eq 2
|
53
|
+
expect(forecast_q4[:quarter]).to eq 4
|
54
|
+
|
55
|
+
expect(forecast_q4[:previous_forecast_net_sales]).to eq 15500
|
56
|
+
expect(forecast_q4[:previous_forecast_operating_income]).to eq 2250
|
57
|
+
expect(forecast_q4[:previous_forecast_ordinary_income]).to eq 2240
|
58
|
+
expect(forecast_q4[:previous_forecast_net_income]).to eq 1240
|
59
|
+
expect(forecast_q4[:previous_forecast_net_income_per_share]).to eq 112.13
|
60
|
+
|
61
|
+
expect(forecast_q4[:forecast_net_sales]).to eq 16180
|
62
|
+
expect(forecast_q4[:forecast_operating_income]).to eq 2529
|
63
|
+
expect(forecast_q4[:forecast_ordinary_income]).to eq 2521
|
64
|
+
expect(forecast_q4[:forecast_net_income]).to eq 1387
|
65
|
+
expect(forecast_q4[:forecast_net_income_per_share]).to eq 125.30
|
66
|
+
|
67
|
+
expect(forecast_q4[:change_forecast_net_sales]).to eq 0.044
|
68
|
+
expect(forecast_q4[:change_forecast_operating_income]).to eq 0.124
|
69
|
+
expect(forecast_q4[:change_forecast_ordinary_income]).to eq 0.126
|
70
|
+
expect(forecast_q4[:change_forecast_net_income]).to eq 0.119
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context '日本会計基準' do
|
75
|
+
context "連結・通期" do
|
76
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/jp-cons-2014.htm") }
|
77
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 4 } }
|
78
|
+
|
79
|
+
it do
|
80
|
+
expect(forecast[:code]).to eq('6883')
|
81
|
+
expect(forecast[:year]).to eq(2014)
|
82
|
+
expect(forecast[:month]).to eq(3)
|
83
|
+
expect(forecast[:quarter]).to eq(4)
|
84
|
+
|
85
|
+
expect(forecast[:previous_forecast_net_sales]).to eq(29000)
|
86
|
+
expect(forecast[:previous_forecast_operating_income]).to eq(4150)
|
87
|
+
expect(forecast[:previous_forecast_ordinary_income]).to eq(4350)
|
88
|
+
expect(forecast[:previous_forecast_net_income]).to eq(3000)
|
89
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to eq(45.25)
|
90
|
+
|
91
|
+
expect(forecast[:forecast_net_sales]).to eq(30500)
|
92
|
+
expect(forecast[:forecast_operating_income]).to eq(5000)
|
93
|
+
expect(forecast[:forecast_ordinary_income]).to eq(5200)
|
94
|
+
expect(forecast[:forecast_net_income]).to eq(3800)
|
95
|
+
expect(forecast[:forecast_net_income_per_share]).to eq(57.31)
|
96
|
+
|
97
|
+
expect(forecast[:change_forecast_net_sales]).to eq(0.052)
|
98
|
+
expect(forecast[:change_forecast_operating_income]).to eq(0.205)
|
99
|
+
expect(forecast[:change_forecast_ordinary_income]).to eq(0.195)
|
100
|
+
expect(forecast[:change_forecast_net_income]).to eq(0.267)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context '米国会計基準' do
|
106
|
+
context '連結・通期' do
|
107
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/us-cons-2014.htm") }
|
108
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 4 } }
|
109
|
+
|
110
|
+
it do
|
111
|
+
expect(forecast[:code]).to eq '6586'
|
112
|
+
expect(forecast[:year]).to eq 2014
|
113
|
+
expect(forecast[:month]).to eq 3
|
114
|
+
expect(forecast[:quarter]).to eq 4
|
115
|
+
|
116
|
+
expect(forecast[:previous_forecast_net_sales]).to eq 360000
|
117
|
+
expect(forecast[:previous_forecast_operating_income]).to eq 49000
|
118
|
+
expect(forecast[:previous_forecast_ordinary_income]).to eq 50400
|
119
|
+
expect(forecast[:previous_forecast_net_income]).to eq 35700
|
120
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to eq 263.0
|
121
|
+
|
122
|
+
expect(forecast[:forecast_net_sales]).to eq 370000
|
123
|
+
expect(forecast[:forecast_operating_income]).to eq 53000
|
124
|
+
expect(forecast[:forecast_ordinary_income]).to eq 55500
|
125
|
+
expect(forecast[:forecast_net_income]).to eq 39000
|
126
|
+
expect(forecast[:forecast_net_income_per_share]).to eq 287.31
|
127
|
+
|
128
|
+
expect(forecast[:change_forecast_net_sales]).to eq 0.028
|
129
|
+
expect(forecast[:change_forecast_operating_income]).to eq 0.082
|
130
|
+
expect(forecast[:change_forecast_ordinary_income]).to eq 0.101
|
131
|
+
expect(forecast[:change_forecast_net_income]).to eq 0.092
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'IFRS' do
|
137
|
+
context '連結・通期' do
|
138
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/ifrs-cons-2014.htm") }
|
139
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 4 } }
|
140
|
+
|
141
|
+
it do
|
142
|
+
expect(forecast[:code]).to eq '6779'
|
143
|
+
expect(forecast[:year]).to eq 2014
|
144
|
+
expect(forecast[:month]).to eq 3
|
145
|
+
expect(forecast[:quarter]).to eq 4
|
146
|
+
|
147
|
+
expect(forecast[:previous_forecast_net_sales]).to eq 51000
|
148
|
+
expect(forecast[:previous_forecast_operating_income]).to eq 700
|
149
|
+
expect(forecast[:previous_forecast_ordinary_income]).to eq 500
|
150
|
+
expect(forecast[:previous_forecast_net_income]).to eq 400
|
151
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to eq 20.38
|
152
|
+
|
153
|
+
expect(forecast[:forecast_net_sales]).to eq 50774
|
154
|
+
expect(forecast[:forecast_operating_income]).to eq 240
|
155
|
+
expect(forecast[:forecast_ordinary_income]).to eq 191
|
156
|
+
expect(forecast[:forecast_net_income]).to eq 181
|
157
|
+
expect(forecast[:forecast_net_income_per_share]).to eq 9.25
|
158
|
+
|
159
|
+
expect(forecast[:change_forecast_net_sales]).to eq -0.004
|
160
|
+
expect(forecast[:change_forecast_operating_income]).to eq -0.657
|
161
|
+
expect(forecast[:change_forecast_ordinary_income]).to eq -0.618
|
162
|
+
expect(forecast[:change_forecast_net_income]).to eq -0.548
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context '1Q予想' do
|
168
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/1q.htm") }
|
169
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 1 } }
|
170
|
+
|
171
|
+
it do
|
172
|
+
expect(forecast[:code]).to eq('3656')
|
173
|
+
expect(forecast[:year]).to eq(2014)
|
174
|
+
expect(forecast[:month]).to eq(12)
|
175
|
+
expect(forecast[:quarter]).to eq(1)
|
176
|
+
|
177
|
+
expect(forecast[:previous_forecast_net_sales]).to eq(4050)
|
178
|
+
expect(forecast[:previous_forecast_operating_income]).to eq(-90)
|
179
|
+
expect(forecast[:previous_forecast_ordinary_income]).to eq(-86)
|
180
|
+
expect(forecast[:previous_forecast_net_income]).to eq(-86)
|
181
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to eq(-2.61)
|
182
|
+
|
183
|
+
expect(forecast[:forecast_net_sales]).to eq(4425)
|
184
|
+
expect(forecast[:forecast_operating_income]).to eq(96)
|
185
|
+
expect(forecast[:forecast_ordinary_income]).to eq(106)
|
186
|
+
expect(forecast[:forecast_net_income]).to eq(51)
|
187
|
+
expect(forecast[:forecast_net_income_per_share]).to eq(1.56)
|
188
|
+
|
189
|
+
expect(forecast[:change_forecast_net_sales]).to eq(0.093)
|
190
|
+
expect(forecast[:change_forecast_operating_income]).to be_nil
|
191
|
+
expect(forecast[:change_forecast_ordinary_income]).to be_nil
|
192
|
+
expect(forecast[:change_forecast_net_income]).to be_nil
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context '3Q予想' do
|
197
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/3q.htm") }
|
198
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 3 } }
|
199
|
+
|
200
|
+
it do
|
201
|
+
expect(forecast[:code]).to eq('8742')
|
202
|
+
expect(forecast[:year]).to eq(2014)
|
203
|
+
expect(forecast[:month]).to eq(3)
|
204
|
+
expect(forecast[:quarter]).to eq(3)
|
205
|
+
|
206
|
+
expect(forecast[:previous_forecast_net_sales]).to be_nil
|
207
|
+
expect(forecast[:previous_forecast_operating_income]).to be_nil
|
208
|
+
expect(forecast[:previous_forecast_ordinary_income]).to be_nil
|
209
|
+
expect(forecast[:previous_forecast_net_income]).to be_nil
|
210
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to be_nil
|
211
|
+
|
212
|
+
expect(forecast[:forecast_net_sales]).to eq 2332
|
213
|
+
expect(forecast[:forecast_operating_income]).to eq -470
|
214
|
+
expect(forecast[:forecast_ordinary_income]).to eq -389
|
215
|
+
expect(forecast[:forecast_net_income]).to eq -86
|
216
|
+
expect(forecast[:forecast_net_income_per_share]).to be_nil
|
217
|
+
|
218
|
+
expect(forecast[:change_forecast_net_sales]).to be_nil
|
219
|
+
expect(forecast[:change_forecast_operating_income]).to be_nil
|
220
|
+
expect(forecast[:change_forecast_ordinary_income]).to be_nil
|
221
|
+
expect(forecast[:change_forecast_net_income]).to be_nil
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'レンジ予想' do
|
226
|
+
let(:xbrl) { ResultsForecast2.read doc("#{dir}/range.htm") }
|
227
|
+
let(:forecast) { xbrl[:results_forecast].find {|forecast| forecast[:quarter] == 4 } }
|
228
|
+
|
229
|
+
it do
|
230
|
+
expect(forecast[:code]).to eq('4918')
|
231
|
+
expect(forecast[:year]).to eq(2014)
|
232
|
+
expect(forecast[:month]).to eq(3)
|
233
|
+
expect(forecast[:quarter]).to eq(4)
|
234
|
+
|
235
|
+
expect(forecast[:previous_forecast_net_sales]).to be_nil
|
236
|
+
expect(forecast[:previous_forecast_operating_income]).to be_nil
|
237
|
+
expect(forecast[:previous_forecast_ordinary_income]).to be_nil
|
238
|
+
expect(forecast[:previous_forecast_net_income]).to be_nil
|
239
|
+
expect(forecast[:previous_forecast_net_income_per_share]).to be_nil
|
240
|
+
|
241
|
+
expect(forecast[:forecast_net_sales]).to be_nil
|
242
|
+
expect(forecast[:forecast_operating_income]).to be_nil
|
243
|
+
expect(forecast[:forecast_ordinary_income]).to be_nil
|
244
|
+
expect(forecast[:forecast_net_income]).to be_nil
|
245
|
+
expect(forecast[:forecast_net_income_per_share]).to be_nil
|
246
|
+
|
247
|
+
expect(forecast[:change_forecast_net_sales]).to be_nil
|
248
|
+
expect(forecast[:change_forecast_operating_income]).to be_nil
|
249
|
+
expect(forecast[:change_forecast_ordinary_income]).to be_nil
|
250
|
+
expect(forecast[:change_forecast_net_income]).to be_nil
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module LiteXBRL
|
4
|
+
module TDnet
|
5
|
+
describe ResultsForecastAttribute do
|
6
|
+
include ResultsForecastAttribute
|
7
|
+
|
8
|
+
describe "#attributes" do
|
9
|
+
it do
|
10
|
+
self.code = 1111
|
11
|
+
self.year = 2013
|
12
|
+
self.month = 3
|
13
|
+
self.quarter = 1
|
14
|
+
self.forecast_net_sales = 100
|
15
|
+
self.forecast_operating_income = 10
|
16
|
+
self.forecast_ordinary_income = 11
|
17
|
+
self.forecast_net_income = 6
|
18
|
+
self.forecast_net_income_per_share = 123.1
|
19
|
+
|
20
|
+
self.previous_forecast_net_sales = 90
|
21
|
+
self.previous_forecast_operating_income = 9
|
22
|
+
self.previous_forecast_ordinary_income = 10
|
23
|
+
self.previous_forecast_net_income = 5
|
24
|
+
self.previous_forecast_net_income_per_share = 113.1
|
25
|
+
|
26
|
+
self.change_forecast_net_sales = 110
|
27
|
+
self.change_forecast_operating_income = 20
|
28
|
+
self.change_forecast_ordinary_income = 21
|
29
|
+
self.change_forecast_net_income = 16
|
30
|
+
|
31
|
+
attr = attributes
|
32
|
+
|
33
|
+
expect(attr[:code]).to eq(1111)
|
34
|
+
expect(attr[:year]).to eq(2013)
|
35
|
+
expect(attr[:month]).to eq(3)
|
36
|
+
expect(attr[:quarter]).to eq(1)
|
37
|
+
expect(attr[:forecast_net_sales]).to eq(100)
|
38
|
+
expect(attr[:forecast_operating_income]).to eq(10)
|
39
|
+
expect(attr[:forecast_ordinary_income]).to eq(11)
|
40
|
+
expect(attr[:forecast_net_income]).to eq(6)
|
41
|
+
expect(attr[:forecast_net_income_per_share]).to eq(123.1)
|
42
|
+
|
43
|
+
expect(attr[:previous_forecast_net_sales]).to eq(90)
|
44
|
+
expect(attr[:previous_forecast_operating_income]).to eq(9)
|
45
|
+
expect(attr[:previous_forecast_ordinary_income]).to eq(10)
|
46
|
+
expect(attr[:previous_forecast_net_income]).to eq(5)
|
47
|
+
expect(attr[:previous_forecast_net_income_per_share]).to eq(113.1)
|
48
|
+
|
49
|
+
expect(attr[:change_forecast_net_sales]).to eq(110)
|
50
|
+
expect(attr[:change_forecast_operating_income]).to eq(20)
|
51
|
+
expect(attr[:change_forecast_ordinary_income]).to eq(21)
|
52
|
+
expect(attr[:change_forecast_net_income]).to eq(16)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/nokogiri_helper'
|
3
|
+
|
4
|
+
module LiteXBRL
|
5
|
+
module TDnet
|
6
|
+
describe ResultsForecast do
|
7
|
+
include NokogiriHelper
|
8
|
+
|
9
|
+
let(:dir) { File.expand_path '../../data/tdnet/results_forecast', __FILE__ }
|
10
|
+
|
11
|
+
describe ".find_consolidation" do
|
12
|
+
it "非連結" do
|
13
|
+
consolidation = ResultsForecast.send(:find_consolidation, doc("#{dir}/jp-noncons-2014.xbrl"))
|
14
|
+
expect(consolidation).to eq("NonConsolidated")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".read" do
|
19
|
+
context '日本会計基準' do
|
20
|
+
context "連結" do
|
21
|
+
let(:xbrl) { (ResultsForecast.read doc("#{dir}/jp-cons-2012.xbrl"))[:results_forecast][1] }
|
22
|
+
|
23
|
+
it do
|
24
|
+
expect(xbrl[:code]).to eq('4368')
|
25
|
+
expect(xbrl[:year]).to eq(2012)
|
26
|
+
expect(xbrl[:month]).to eq(3)
|
27
|
+
expect(xbrl[:quarter]).to eq(4)
|
28
|
+
|
29
|
+
expect(xbrl[:forecast_net_sales]).to eq(28300)
|
30
|
+
expect(xbrl[:forecast_operating_income]).to eq(3850)
|
31
|
+
expect(xbrl[:forecast_ordinary_income]).to eq(3700)
|
32
|
+
expect(xbrl[:forecast_net_income]).to eq(2400)
|
33
|
+
expect(xbrl[:forecast_net_income_per_share]).to eq(380.87)
|
34
|
+
|
35
|
+
expect(xbrl[:previous_forecast_net_sales]).to eq(30300)
|
36
|
+
expect(xbrl[:previous_forecast_operating_income]).to eq(4700)
|
37
|
+
expect(xbrl[:previous_forecast_ordinary_income]).to eq(4400)
|
38
|
+
expect(xbrl[:previous_forecast_net_income]).to eq(3050)
|
39
|
+
expect(xbrl[:previous_forecast_net_income_per_share]).to eq(484.02)
|
40
|
+
|
41
|
+
expect(xbrl[:change_forecast_net_sales]).to eq(-0.066)
|
42
|
+
expect(xbrl[:change_forecast_operating_income]).to eq(-0.181)
|
43
|
+
expect(xbrl[:change_forecast_ordinary_income]).to eq(-0.159)
|
44
|
+
expect(xbrl[:change_forecast_net_income]).to eq(-0.213)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context '米国会計基準' do
|
50
|
+
context '連結' do
|
51
|
+
let(:xbrl) { (ResultsForecast.read doc("#{dir}/us-cons-2014.xbrl"))[:results_forecast][1] }
|
52
|
+
|
53
|
+
it do
|
54
|
+
expect(xbrl[:code]).to eq('6594')
|
55
|
+
expect(xbrl[:year]).to eq(2014)
|
56
|
+
expect(xbrl[:month]).to eq(3)
|
57
|
+
expect(xbrl[:quarter]).to eq(4)
|
58
|
+
|
59
|
+
expect(xbrl[:forecast_net_sales]).to eq(850000)
|
60
|
+
expect(xbrl[:forecast_operating_income]).to eq(80000)
|
61
|
+
expect(xbrl[:forecast_ordinary_income]).to eq(78000)
|
62
|
+
expect(xbrl[:forecast_net_income]).to eq(55000)
|
63
|
+
expect(xbrl[:forecast_net_income_per_share]).to eq(404.26)
|
64
|
+
|
65
|
+
expect(xbrl[:previous_forecast_net_sales]).to eq(820000)
|
66
|
+
expect(xbrl[:previous_forecast_operating_income]).to eq(75000)
|
67
|
+
expect(xbrl[:previous_forecast_ordinary_income]).to eq(73000)
|
68
|
+
expect(xbrl[:previous_forecast_net_income]).to eq(53500)
|
69
|
+
expect(xbrl[:previous_forecast_net_income_per_share]).to eq(398.72)
|
70
|
+
|
71
|
+
expect(xbrl[:change_forecast_net_sales]).to eq(0.037)
|
72
|
+
expect(xbrl[:change_forecast_operating_income]).to eq(0.067)
|
73
|
+
expect(xbrl[:change_forecast_ordinary_income]).to eq(0.068)
|
74
|
+
expect(xbrl[:change_forecast_net_income]).to eq(0.028)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'IFRS' do
|
80
|
+
context '連結' do
|
81
|
+
let(:xbrl) { (ResultsForecast.read doc("#{dir}/ifrs-cons-2014.xbrl"))[:results_forecast][1] }
|
82
|
+
|
83
|
+
it do
|
84
|
+
expect(xbrl[:code]).to eq('6779')
|
85
|
+
expect(xbrl[:year]).to eq(2014)
|
86
|
+
expect(xbrl[:month]).to eq(3)
|
87
|
+
expect(xbrl[:quarter]).to eq(4)
|
88
|
+
|
89
|
+
expect(xbrl[:forecast_net_sales]).to eq(51000)
|
90
|
+
expect(xbrl[:forecast_operating_income]).to eq(700)
|
91
|
+
expect(xbrl[:forecast_ordinary_income]).to eq(500)
|
92
|
+
expect(xbrl[:forecast_net_income]).to eq(400)
|
93
|
+
expect(xbrl[:forecast_net_income_per_share]).to eq(20.38)
|
94
|
+
|
95
|
+
expect(xbrl[:previous_forecast_net_sales]).to eq(51000)
|
96
|
+
expect(xbrl[:previous_forecast_operating_income]).to eq(1500)
|
97
|
+
expect(xbrl[:previous_forecast_ordinary_income]).to eq(1100)
|
98
|
+
expect(xbrl[:previous_forecast_net_income]).to eq(1000)
|
99
|
+
expect(xbrl[:previous_forecast_net_income_per_share]).to eq(50.95)
|
100
|
+
|
101
|
+
# expect(xbrl[:change_forecast_net_sales]).to eq(0.037)
|
102
|
+
expect(xbrl[:change_forecast_operating_income]).to eq(-0.533)
|
103
|
+
expect(xbrl[:change_forecast_ordinary_income]).to eq(-0.545)
|
104
|
+
expect(xbrl[:change_forecast_net_income]).to eq(-0.6)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/nokogiri_helper'
|
3
|
+
|
4
|
+
module LiteXBRL
|
5
|
+
module TDnet
|
6
|
+
describe Summary2 do
|
7
|
+
include NokogiriHelper
|
8
|
+
|
9
|
+
let(:dir) { File.expand_path '../../data/tdnet/summary2', __FILE__ }
|
10
|
+
|
11
|
+
describe ".find_consolidation" do
|
12
|
+
it "非連結" do
|
13
|
+
consolidation = Summary2.send(:find_consolidation, doc("#{dir}/jp-noncons-2014-q4.htm"), Summary2::SEASON_Q4)
|
14
|
+
expect(consolidation).to eq "NonConsolidated"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".context_hash" do
|
19
|
+
let(:consolidation) { 'Consolidated' }
|
20
|
+
let(:season) { 'AccumulatedQ1' }
|
21
|
+
let(:quarter) { 1 }
|
22
|
+
|
23
|
+
it "context" do
|
24
|
+
context_hash = Summary2.send(:context_hash, consolidation, season)
|
25
|
+
|
26
|
+
expect(context_hash[:context_duration]).to eq('CurrentAccumulatedQ1Duration_ConsolidatedMember_ResultMember')
|
27
|
+
expect(context_hash[:context_instant]).to eq('CurrentAccumulatedQ1Instant')
|
28
|
+
expect(context_hash[:context_forecast].call(quarter)).to eq('CurrentYearDuration_ConsolidatedMember_ForecastMember')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe ".read" do
|
33
|
+
context '日本会計基準' do
|
34
|
+
context "連結・第1四半期" do
|
35
|
+
let(:xbrl) { Summary2.read doc("#{dir}/jp-cons-2014-q1.htm") }
|
36
|
+
let(:summary) { xbrl[:summary] }
|
37
|
+
let(:results_forecast) { xbrl[:results_forecast].first }
|
38
|
+
|
39
|
+
it do
|
40
|
+
expect(summary[:code]).to eq('3046')
|
41
|
+
expect(summary[:year]).to eq(2014)
|
42
|
+
expect(summary[:month]).to eq(8)
|
43
|
+
expect(summary[:quarter]).to eq(1)
|
44
|
+
|
45
|
+
expect(summary[:net_sales]).to eq(8168)
|
46
|
+
expect(summary[:operating_income]).to eq(249)
|
47
|
+
expect(summary[:ordinary_income]).to eq(219)
|
48
|
+
expect(summary[:net_income]).to eq(70)
|
49
|
+
expect(summary[:net_income_per_share]).to eq(2.92)
|
50
|
+
|
51
|
+
expect(summary[:change_in_net_sales]).to eq(0.047)
|
52
|
+
expect(summary[:change_in_operating_income]).to eq(-0.819)
|
53
|
+
expect(summary[:change_in_ordinary_income]).to eq(-0.832)
|
54
|
+
expect(summary[:change_in_net_income]).to eq(-0.909)
|
55
|
+
|
56
|
+
expect(summary[:prior_net_sales]).to eq(7799)
|
57
|
+
expect(summary[:prior_operating_income]).to eq(1377)
|
58
|
+
expect(summary[:prior_ordinary_income]).to eq(1301)
|
59
|
+
expect(summary[:prior_net_income]).to eq(766)
|
60
|
+
expect(summary[:prior_net_income_per_share]).to eq(31.95)
|
61
|
+
|
62
|
+
expect(summary[:change_in_prior_net_sales]).to eq(0.853)
|
63
|
+
expect(summary[:change_in_prior_operating_income]).to eq(6.587)
|
64
|
+
expect(summary[:change_in_prior_ordinary_income]).to eq(6.641)
|
65
|
+
expect(summary[:change_in_prior_net_income]).to be_nil
|
66
|
+
|
67
|
+
expect(results_forecast[:forecast_net_sales]).to eq(40600)
|
68
|
+
expect(results_forecast[:forecast_operating_income]).to eq(6800)
|
69
|
+
expect(results_forecast[:forecast_ordinary_income]).to eq(6850)
|
70
|
+
expect(results_forecast[:forecast_net_income]).to eq(3900)
|
71
|
+
expect(results_forecast[:forecast_net_income_per_share]).to eq(162.66)
|
72
|
+
|
73
|
+
expect(results_forecast[:change_in_forecast_net_sales]).to eq(0.111)
|
74
|
+
expect(results_forecast[:change_in_forecast_operating_income]).to eq(0.093)
|
75
|
+
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq(0.167)
|
76
|
+
expect(results_forecast[:change_in_forecast_net_income]).to eq(0.141)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "連結・第4四半期" do
|
81
|
+
let(:xbrl) { Summary2.read doc("#{dir}/jp-cons-2013-q4.htm") }
|
82
|
+
let(:summary) { xbrl[:summary] }
|
83
|
+
let(:results_forecast) { xbrl[:results_forecast].first }
|
84
|
+
|
85
|
+
it do
|
86
|
+
expect(summary[:code]).to eq('2408')
|
87
|
+
expect(summary[:year]).to eq(2013)
|
88
|
+
expect(summary[:month]).to eq(12)
|
89
|
+
expect(summary[:quarter]).to eq(4)
|
90
|
+
|
91
|
+
expect(summary[:net_sales]).to eq(4691)
|
92
|
+
expect(summary[:operating_income]).to eq(759)
|
93
|
+
expect(summary[:ordinary_income]).to eq(821)
|
94
|
+
expect(summary[:net_income]).to eq(493)
|
95
|
+
expect(summary[:net_income_per_share]).to eq(67.03)
|
96
|
+
|
97
|
+
expect(summary[:change_in_net_sales]).to eq(-0.008)
|
98
|
+
expect(summary[:change_in_operating_income]).to eq(-0.206)
|
99
|
+
expect(summary[:change_in_ordinary_income]).to eq(-0.184)
|
100
|
+
expect(summary[:change_in_net_income]).to eq(-0.147)
|
101
|
+
|
102
|
+
expect(summary[:prior_net_sales]).to eq(4727)
|
103
|
+
expect(summary[:prior_operating_income]).to eq(956)
|
104
|
+
expect(summary[:prior_ordinary_income]).to eq(1005)
|
105
|
+
expect(summary[:prior_net_income]).to eq(579)
|
106
|
+
expect(summary[:prior_net_income_per_share]).to eq(79.73)
|
107
|
+
|
108
|
+
expect(summary[:change_in_prior_net_sales]).to eq(0.008)
|
109
|
+
expect(summary[:change_in_prior_operating_income]).to eq(0.036)
|
110
|
+
expect(summary[:change_in_prior_ordinary_income]).to eq(0.039)
|
111
|
+
expect(summary[:change_in_prior_net_income]).to eq(0.287)
|
112
|
+
|
113
|
+
expect(results_forecast[:forecast_net_sales]).to eq(5064)
|
114
|
+
expect(results_forecast[:forecast_operating_income]).to eq(509)
|
115
|
+
expect(results_forecast[:forecast_ordinary_income]).to eq(530)
|
116
|
+
expect(results_forecast[:forecast_net_income]).to eq(316)
|
117
|
+
expect(results_forecast[:forecast_net_income_per_share]).to eq(42.91)
|
118
|
+
|
119
|
+
expect(results_forecast[:change_in_forecast_net_sales]).to eq(0.079)
|
120
|
+
expect(results_forecast[:change_in_forecast_operating_income]).to eq(-0.329)
|
121
|
+
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq(-0.354)
|
122
|
+
expect(results_forecast[:change_in_forecast_net_income]).to eq(-0.359)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context '米国会計基準' do
|
128
|
+
context "連結・第4四半期" do
|
129
|
+
let(:xbrl) { Summary2.read doc("#{dir}/us-cons-2014-q4.htm") }
|
130
|
+
let(:summary) { xbrl[:summary] }
|
131
|
+
let(:results_forecast) { xbrl[:results_forecast].first }
|
132
|
+
|
133
|
+
it do
|
134
|
+
expect(summary[:code]).to eq '7203'
|
135
|
+
expect(summary[:year]).to eq 2014
|
136
|
+
expect(summary[:month]).to eq 3
|
137
|
+
expect(summary[:quarter]).to eq 4
|
138
|
+
|
139
|
+
expect(summary[:net_sales]).to eq 25691911
|
140
|
+
expect(summary[:operating_income]).to eq 2292112
|
141
|
+
expect(summary[:ordinary_income]).to eq 2441080
|
142
|
+
expect(summary[:net_income]).to eq 1823119
|
143
|
+
expect(summary[:net_income_per_share]).to eq 575.30
|
144
|
+
|
145
|
+
expect(summary[:change_in_net_sales]).to eq 0.164
|
146
|
+
expect(summary[:change_in_operating_income]).to eq 0.735
|
147
|
+
expect(summary[:change_in_ordinary_income]).to eq 0.739
|
148
|
+
expect(summary[:change_in_net_income]).to eq 0.895
|
149
|
+
|
150
|
+
expect(summary[:prior_net_sales]).to eq 22064192
|
151
|
+
expect(summary[:prior_operating_income]).to eq 1320888
|
152
|
+
expect(summary[:prior_ordinary_income]).to eq 1403649
|
153
|
+
expect(summary[:prior_net_income]).to eq 962163
|
154
|
+
expect(summary[:prior_net_income_per_share]).to eq 303.82
|
155
|
+
|
156
|
+
expect(summary[:change_in_prior_net_sales]).to eq 0.187
|
157
|
+
expect(summary[:change_in_prior_operating_income]).to eq 2.714
|
158
|
+
expect(summary[:change_in_prior_ordinary_income]).to eq 2.243
|
159
|
+
expect(summary[:change_in_prior_net_income]).to eq 2.393
|
160
|
+
|
161
|
+
expect(results_forecast[:forecast_net_sales]).to eq 25700000
|
162
|
+
expect(results_forecast[:forecast_operating_income]).to eq 2300000
|
163
|
+
expect(results_forecast[:forecast_ordinary_income]).to eq 2390000
|
164
|
+
expect(results_forecast[:forecast_net_income]).to eq 1780000
|
165
|
+
expect(results_forecast[:forecast_net_income_per_share]).to eq 561.56
|
166
|
+
|
167
|
+
expect(results_forecast[:change_in_forecast_net_sales]).to eq 0.0
|
168
|
+
expect(results_forecast[:change_in_forecast_operating_income]).to eq 0.003
|
169
|
+
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq -0.021
|
170
|
+
expect(results_forecast[:change_in_forecast_net_income]).to eq -0.024
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'IFRS' do
|
176
|
+
let(:xbrl) { Summary2.read doc("#{dir}/ifrs-cons-2013-q4.htm") }
|
177
|
+
let(:summary) { xbrl[:summary] }
|
178
|
+
let(:results_forecast) { xbrl[:results_forecast].first }
|
179
|
+
|
180
|
+
it do
|
181
|
+
expect(summary[:code]).to eq('8923')
|
182
|
+
expect(summary[:year]).to eq(2013)
|
183
|
+
expect(summary[:month]).to eq(11)
|
184
|
+
expect(summary[:quarter]).to eq(4)
|
185
|
+
|
186
|
+
expect(summary[:net_sales]).to eq(35070)
|
187
|
+
expect(summary[:operating_income]).to eq(3909)
|
188
|
+
expect(summary[:ordinary_income]).to eq(3217)
|
189
|
+
expect(summary[:net_income]).to eq(2003)
|
190
|
+
expect(summary[:net_income_per_share]).to eq(42.99)
|
191
|
+
|
192
|
+
expect(summary[:change_in_net_sales]).to eq(0.449)
|
193
|
+
expect(summary[:change_in_operating_income]).to eq(0.369)
|
194
|
+
expect(summary[:change_in_ordinary_income]).to eq(0.45)
|
195
|
+
expect(summary[:change_in_net_income]).to eq(0.367)
|
196
|
+
|
197
|
+
expect(summary[:prior_net_sales]).to eq(24195)
|
198
|
+
expect(summary[:prior_operating_income]).to eq(2856)
|
199
|
+
expect(summary[:prior_ordinary_income]).to eq(2218)
|
200
|
+
expect(summary[:prior_net_income]).to eq(1465)
|
201
|
+
expect(summary[:prior_net_income_per_share]).to eq(32.07)
|
202
|
+
|
203
|
+
# expect(xbrl.change_in_prior_net_sales).to eq(0.008)
|
204
|
+
# expect(xbrl.change_in_prior_operating_income).to eq(0.036)
|
205
|
+
# expect(xbrl.change_in_prior_ordinary_income).to eq(0.039)
|
206
|
+
# expect(xbrl.change_in_prior_net_income).to eq(0.287)
|
207
|
+
|
208
|
+
expect(results_forecast[:forecast_net_sales]).to eq(41817)
|
209
|
+
expect(results_forecast[:forecast_operating_income]).to eq(4618)
|
210
|
+
expect(results_forecast[:forecast_ordinary_income]).to eq(3800)
|
211
|
+
expect(results_forecast[:forecast_net_income]).to eq(2309)
|
212
|
+
expect(results_forecast[:forecast_net_income_per_share]).to eq(47.82)
|
213
|
+
|
214
|
+
expect(results_forecast[:change_in_forecast_net_sales]).to eq(0.192)
|
215
|
+
expect(results_forecast[:change_in_forecast_operating_income]).to eq(0.181)
|
216
|
+
expect(results_forecast[:change_in_forecast_ordinary_income]).to eq(0.181)
|
217
|
+
expect(results_forecast[:change_in_forecast_net_income]).to eq(0.153)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe '.read_company' do
|
223
|
+
context '日本会計基準' do
|
224
|
+
let(:xbrl) { Summary2.parse_company str("#{dir}/jp-cons-2014-q1.htm") }
|
225
|
+
|
226
|
+
it do
|
227
|
+
expect(xbrl.company_name).to eq("株式会社 ジェイアイエヌ")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
describe "#attributes_company" do
|
233
|
+
it do
|
234
|
+
summary = Summary2.new
|
235
|
+
summary.code = "1111"
|
236
|
+
summary.company_name = "aaa"
|
237
|
+
|
238
|
+
attr = summary.attributes_company
|
239
|
+
|
240
|
+
expect(attr[:code]).to eq("1111")
|
241
|
+
expect(attr[:company_name]).to eq("aaa")
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|