forked from zdavatz/oddb.org
/
test_patinfo_hpricot.rb
executable file
·848 lines (814 loc) · 47.6 KB
/
test_patinfo_hpricot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
#!/usr/bin/env ruby
# encoding: utf-8
# ODDB::FiParse::TestPatinfoHpricot -- oddb.org -- 09.04.2012 -- yasaka@ywesee.com
# ODDB::FiParse::TestPatinfoHpricot -- oddb.org -- 20.06.2011 -- mhatakeyama@ywesee.com
# ODDB::FiParse::TestPatinfoHpricot -- oddb.org -- 17.08.2006 -- hwyss@ywesee.com
require 'hpricot'
$: << File.expand_path('../src', File.dirname(__FILE__))
$: << File.expand_path('../../../src', File.dirname(__FILE__))
$: << File.expand_path('../../..', File.dirname(__FILE__))
require 'minitest/autorun'
require 'flexmock/minitest'
require 'patinfo_hpricot'
require 'plugin/text_info'
$: << File.expand_path('../../../test', File.dirname(__FILE__))
require 'stub/cgi'
module ODDB
module FiParse
class TestPatinfoHpricot <Minitest::Test
def setup
@writer = PatinfoHpricot.new
end
def test_nasivin_spaces
html = <<-HTML
<div class="paragraph">
<h2><a name="7840">Was ist in Cimifemin enthalten?</a></h2>
<p class="s3"><span class="s4"><span>ab 6 Ja</span></span><span class="s4"><span>hren angewendet werden. Nasivin </span></span><span class="s4"><span>Nasentropfen 0.025% dürfen nur bei</span></span></p>
</div>
HTML
code, chapter = @writer.chapter(Hpricot(html).at("div.paragraph"))
assert_equal('7840', code)
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist in Cimifemin enthalten?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "ab 6 Jahren angewendet werden. Nasivin Nasentropfen 0.025% dürfen nur bei"
assert_equal(1, paragraph.formats.size)
assert_equal(expected, paragraph.text)
end
def test_chapter
html = <<-HTML
<div class="paragraph">
<h2><a name="7840">Was ist in Cimifemin enthalten?</a></h2>
<p class="spacing"><span style="font-style: italic;">1 Tablette</span>
enthält: 0,018-0,026 ml Flüssigextrakt aus Cimicifugawurzelstock
(Traubensilberkerze), (DEV: 0,78-1,14:1), Auszugsmittel Isopropanol 40%
(V/V).</p>
<p class="noSpacing">Dieses Präparat enthält zusätzlich Hilfsstoffe.</p>
</div>
HTML
code, chapter = @writer.chapter(Hpricot(html).at("div.paragraph"))
assert_equal('7840', code)
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist in Cimifemin enthalten?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "1 Tablette enthält: 0,018-0,026 ml Flüssigextrakt aus "
expected << "Cimicifugawurzelstock (Traubensilberkerze), "
expected << "(DEV: 0,78-1,14:1), Auszugsmittel Isopropanol 40% (V/V)."
assert_equal(2, paragraph.formats.size)
fmt = paragraph.formats.first
assert_equal([:italic], fmt.values)
assert_equal(0..9, fmt.range)
fmt = paragraph.formats.last
assert_equal([], fmt.values)
assert_equal(10..-1, fmt.range)
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Dieses Präparat enthält zusätzlich Hilfsstoffe."
assert_equal(expected, paragraph.text)
end
def test_chapter__with_sections_ponstan
html = <<-HTML
<div class="paragraph">
<h2><a name="7740">Wie verwenden Sie Ponstan?</a></h2>
<p class="noSpacing">Halten Sie sich generell an die von Ihrem Arzt bzw. Ihrer Ärztin verordneten Richtlinien. Die übliche Dosierung beträgt:</p>
<h3><span style="font-style:italic">Für Erwachsene und Jugendliche über 14 Jahre</span></h3>
<p class="spacing1">Täglich 3 mal 1 Filmtablette bzw. 3 mal 2 Kapseln Ponstan während der Mahlzeiten. Je nach Bedarf kann diese Dosis vermindert oder erhöht werden, jedoch sollten Sie am selben Tag nicht mehr als 4 Filmtabletten oder 8 Kapseln einnehmen. Die übliche Dosierung für Zäpfchen beträgt 3mal täglich 1 Zäpfchen Ponstan zu 500 mg.</p>
<p class="spacing1">Ponstan Zäpfchen sollten Sie nicht mehr als 7 Tage hintereinander anwenden, da es bei längerer Anwendung zu lokalen Reizerscheinungen kommen kann.</p>
<p class="spacing1">Für Kinder im Alter von 6 Monaten bis 14 Jahren wird Ihr Arzt bzw. Ihre Ärztin die Dosis dem Alter entsprechend anpassen. Bei Einnahme von Suspension oder Kapseln gibt man im allgemeinen als Einzeldosis 6,5 mg pro kg Körpergewicht. Bei Verwendung von Zäpfchen werden 12 mg pro kg Körpergewicht verabreicht. Kinder sollten Ponstan nur kurzfristig erhalten, es sei denn zur Behandlung der Still'schen Krankheit.</p>
<p class="spacing1">Ändern Sie nicht von sich aus die verschriebene Dosierung. Wenn Sie glauben, das Arzneimittel wirke zu schwach oder zu stark, so sprechen Sie mit Ihrem Arzt oder Apotheker bzw. mit Ihrer Ärztin oder Apothekerin.</p>
<h3><span style="font-style:italic; ">Dosierungsschema für Kinder</span></h3>
<table cellSpacing="0" cellPadding="0" border="0">
<thead>
<tr>
<th>Alter\302\240\302\240\302\240\302\240Suspension\302\240\302\240\302\240\302\240\302\240Kapseln\302\240\302\240\302\240\302\240\302\240Zäpfchen\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</th>
</tr>
<tr>
<th>in\302\240\302\240\302\240\302\240\302\240\302\240\302\240zu\302\24010\302\240mg/ml\302\240\302\240\302\240\302\240zu\302\240250\302\240mg\302\240\302\240\302\240125\302\240bzw.\302\240500\302\240mg\302\240</th>
</tr>
<tr>
<th class="rowSepBelow">Jahren\302\240\302\240\302\240pro\302\240Tag\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240pro\302\240Tag\302\240\302\240\302\240\302\240\302\240pro\302\240Tag\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</th>
</tr>
</thead>
<tbody>
<tr>
<td>½\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\2405\302\240ml\302\240\302\240\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240-\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td class="rowSepBelow">\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240125\302\240mg\302\2402-3×\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>1-3\302\240\302\240\302\240\302\240\302\240\302\2407,5\302\240ml\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240-\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td class="rowSepBelow">\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240125\302\240mg\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>3-6\302\240\302\240\302\240\302\240\302\240\302\24010\302\240ml\302\240\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240-\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td class="rowSepBelow">\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240125\302\240mg\302\2404×\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>6-9\302\240\302\240\302\240\302\240\302\240\302\24015\302\240ml\302\240\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240-\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td class="rowSepBelow">\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240500\302\240mg\302\2401-2×\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>9-12\302\240\302\240\302\240\302\240\302\24020\302\240ml\302\240\302\2403×\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Kps\302\2402-3×\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td class="rowSepBelow">\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240500\302\240mg\302\2402×\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>12-14\302\240\302\240\302\240\302\24025\302\240ml\302\240\302\2403×\302\240\302\240\302\240\302\240\302\240\302\2401\302\240Kps\302\2403×\302\240\302\240\302\240\302\2401\302\240Supp.\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
<tr>
<td>\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240500\302\240mg\302\2403×\302\240\302\240\302\240\302\240\302\240\302\240\302\240</td>
</tr>
</tbody>
</table>
</div>
HTML
code, chapter = @writer.chapter(Hpricot(html).at("div.paragraph"))
assert_equal('7740', code)
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wie verwenden Sie Ponstan?', chapter.heading)
assert_equal(4, chapter.sections.size)
section = chapter.sections.at(0)
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Halten Sie sich generell an die von Ihrem Arzt bzw. Ihrer "
expected << "Ärztin verordneten Richtlinien. Die übliche Dosierung beträgt:"
assert_equal(expected, paragraph.text)
section = chapter.sections.at(1)
assert_equal("Für Erwachsene und Jugendliche über 14 Jahre\n",
section.subheading)
assert_equal(4, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Täglich 3 mal 1 Filmtablette bzw. 3 mal 2 Kapseln Ponstan "
expected << "während der Mahlzeiten. Je nach Bedarf kann diese Dosis "
expected << "vermindert oder erhöht werden, jedoch sollten Sie am selben "
expected << "Tag nicht mehr als 4 Filmtabletten oder 8 Kapseln einnehmen. "
expected << "Die übliche Dosierung für Zäpfchen beträgt 3mal täglich 1 "
expected << "Zäpfchen Ponstan zu 500 mg."
assert_equal(expected, paragraph.text)
section = chapter.sections.at(3)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = %( Alter Suspension Kapseln Zäpfchen
in zu 10 mg/ml zu 250 mg 125 bzw. 500 mg
Jahren pro Tag pro Tag pro Tag
-------------------------------------------------------
½ 5 ml 3× - 1 Supp.
125 mg 2-3×
-------------------------------------------------------
1-3 7,5 ml 3× - 1 Supp.
125 mg 3×
-------------------------------------------------------
3-6 10 ml 3× - 1 Supp.
125 mg 4×
-------------------------------------------------------
6-9 15 ml 3× - 1 Supp.
500 mg 1-2×
-------------------------------------------------------
9-12 20 ml 3× 1 Kps 2-3× 1 Supp.
500 mg 2×
-------------------------------------------------------
12-14 25 ml 3× 1 Kps 3× 1 Supp.
500 mg 3×
)
assert_equal(expected.chomp, paragraph.text)
assert_equal(true, paragraph.preformatted?)
end
def test_identify_chapter__raises_unknown_chaptercode
assert_raises(RuntimeError) {
@writer.identify_chapter('7800', nil)
}
end
def test_identify_chapter__7930
assert_nil(@writer.identify_chapter('7930', nil))
end
def test_identify_chapter__7520
chapter = flexmock('chapter',
:sections => 'sections',
:sections= => nil
)
@writer.identify_chapter('7520', chapter)
assert_equal(chapter, @writer.identify_chapter('7520', chapter))
end
def test_identify_chapter__nil
chapter = flexmock('chapter', :to_s => '12345')
assert_equal(chapter, @writer.identify_chapter(nil, chapter))
end
def test_to_textinfo
assert_kind_of(ODDB::PatinfoDocument, @writer.to_textinfo)
end
end
class TestPatinfoHpricotCimifeminDe <Minitest::Test
def setup
return if defined?(@@path) and defined?(@@patinfo) and @@patinfo
@@path = File.expand_path('data/html/de/cimifemin.html',
File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@patinfo = @@writer.extract(Hpricot(fh))
}
end
def test_patinfo
assert_instance_of(PatinfoDocument2001, @@patinfo)
end
def test_name1
assert_equal('Cimifemin®', @@writer.name.to_s)
end
def test_company1
chapter = @@writer.company
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('ZELLER MEDICAL', chapter.heading)
end
def test_galenic_form1
chapter = @@writer.galenic_form
assert_instance_of(ODDB::Text::Chapter, chapter)
assert_equal('Pflanzliches Arzneimittel', chapter.heading)
assert_equal(0, chapter.sections.size)
end
def test_amzv1
chapter = @@writer.amzv
assert_instance_of(ODDB::Text::Chapter, chapter)
assert_equal('AMZV', chapter.heading)
assert_equal(0, chapter.sections.size)
end
def test_effects1
chapter = @@writer.effects
assert_instance_of(ODDB::Text::Chapter, chapter)
assert_equal("Was ist Cimifemin und wann wird es angewendet?",
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal('', section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.first
expected = "Cimifemin ist ein Arzneimittel mit einem Extrakt aus der "
expected << "Heilpflanze Cimicifuga (Traubensilberkerze). Cimifemin wird "
expected << "bei Beschwerden in den Wechseljahren (Hitzewallungen, "
expected << "Schweissausbrüche, Schlafstörungen, Nervosität und "
expected << "Verstimmungszustände) angewendet. Diese können durch Cimifemin "
expected << "gelindert werden."
assert_equal(expected, paragraph.text)
end
def test_amendments1
chapter = @@writer.amendments
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was sollte dazu beachtet werden?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Bei Spannungs- und Schwellungsgefühl in den Brüsten sowie bei "
expected << "unvorhergesehenen Zwischenblutungen, Schmierblutungen oder bei "
expected << "wiederkehrender Regelblutung sollten Sie Rücksprache mit Ihrem "
expected << "Arzt bzw. Ihrer Ärztin nehmen."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Für Diabetikerinnen geeignet."
assert_equal(expected, paragraph.text)
end
def test_contra_indications1
chapter = @@writer.contra_indications
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wann darf Cimifemin nicht oder nur mit Vorsicht angewendet werden?',
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(4, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Cimifemin darf nicht angewendet werden bei bekannter "
expected << "Überempfindlichkeit auf einen der Inhaltsstoffe oder auf "
expected << "Ranunculaceen (Hahnenfussgewächse)."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Bei vorbestehender Leberschädigung wird von der Einnahme von "
expected << "Cimifemin abgeraten."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(2)
expected = "Dieses Präparat beeinflusst die körperlichen und psychischen "
expected << "Beschwerden in der Abänderung (Klimakterium). Da bisher keine "
expected << "klinischen Daten vorliegen, die eine günstige Wirkung auf die "
expected << "Knochen feststellen lassen, kann deshalb dieses Präparat nicht "
expected << "zur Vorbeugung der Osteoporose verwendet werden."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(3)
expected = "Informieren Sie Ihren Arzt, Apotheker oder Drogisten bzw. Ihre "
expected << "Ärztin, Apothekerin oder Drogistin, wenn Sie an anderen "
expected << "Krankheiten leiden, Allergien haben oder andere Arzneimittel "
expected << "(auch selbstgekaufte) einnehmen!"
assert_equal(expected, paragraph.text)
end
def test_usage1
chapter = @@writer.usage
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wie verwenden Sie Cimifemin?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(3, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Soweit nicht anders verschrieben, 2 mal täglich (morgens und "
expected << "abends) 1 Tablette unzerkaut mit etwas Flüssigkeit einnehmen."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Cimifemin kann längere Zeit angewendet werden, mindestens über "
expected << "einen Zeitraum von 6 Wochen. Eine Anwendung über 6 Monate "
expected << "hinaus soll nur nach Rücksprache mit Ihrem Arzt bzw. Ihrer "
expected << "Ärztin erfolgen."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(2)
expected = "Halten Sie sich an die in der Packungsbeilage angegebene oder "
expected << "vom Arzt bzw. von der Ärztin verschriebene Dosierung. Wenn Sie "
expected << "glauben, das Arzneimittel wirke zu schwach oder zu stark, so "
expected << "sprechen Sie mit Ihrem Arzt, Apotheker oder Drogisten, bzw. "
expected << "Ihrer Ärztin, Apothekerin oder Drogistin."
assert_equal(expected, paragraph.text)
end
def test_unwanted_effects1
chapter = @@writer.unwanted_effects
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Welche Nebenwirkungen kann Cimifemin haben?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(3, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Folgende Nebenwirkungen können bei der Einnahme von Cimifemin "
expected << "auftreten: in seltenen Fällen leichte Magenbeschwerden, "
expected << "Übelkeit, sehr selten bei Überempfindlichkeit Hautausschlag, "
expected << "Juckreiz."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "In sehr seltenen Fällen gibt es Hinweise auf "
expected << "Leberschädigungen. Bei ungewöhnlichem Leistungsabfall, bei "
expected << "Gelbfärbung der Bindehaut der Augen oder der Haut, bei dunklem "
expected << "Urin oder entfärbtem Stuhl sollte Cimifemin abgesetzt und ein "
expected << "Arzt bzw. eine Ärztin aufgesucht werden."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(2)
expected = "Wenn Sie Nebenwirkungen bemerken, die hier nicht beschrieben "
expected << "sind, sollten Sie Ihren Arzt, Apotheker oder Drogisten bzw. "
expected << "Ihre Ärztin, Apothekerin oder Drogistin informieren."
assert_equal(expected, paragraph.text)
end
def test_general_advice1
chapter = @@writer.general_advice
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist ferner zu beachten?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(3, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Arzneimittel sollen für Kinder unerreichbar aufbewahrt werden. "
expected << "Bei Raumtemperatur (15–25 °C) aufbewahren."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Das Arzneimittel darf nur bis zu dem auf dem Behälter mit "
expected << "«Exp» bezeichneten Datum verwendet werden."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(2)
expected = "Weitere Auskünfte erteilt Ihnen Ihr Arzt, Apotheker oder "
expected << "Drogist bzw. Ihre Ärztin, Apothekerin oder Drogistin."
assert_equal(expected, paragraph.text)
end
def test_composition1
chapter = @@writer.composition
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist in Cimifemin enthalten?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "1 Tablette enthält: 0,018–0,026 ml Flüssigextrakt aus "
expected << "Cimicifugawurzelstock (Traubensilberkerze), "
expected << "(DEV: 0,78–1,14:1), Auszugsmittel Isopropanol 40% (V/V)."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Dieses Präparat enthält zusätzlich Hilfsstoffe."
assert_equal(expected, paragraph.text)
end
def test_iksnrs1
chapter = @@writer.iksnrs
assert_instance_of(ODDB::Text::Chapter, chapter)
assert_equal("Zulassungsnummer", chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.first
assert_equal('48734 (Swissmedic).', paragraph.to_s)
end
def test_packages1
chapter = @@writer.packages
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal("Wo erhalten Sie Cimifemin? Welche Packungen sind erhältlich?",
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "In Apotheken und Drogerien, ohne ärztliche Verschreibung."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Packungen zu 30, 60 und 180 Tabletten."
assert_equal(expected, paragraph.text)
assert_equal(3, paragraph.formats.size)
end
def test_distribution1
chapter = @@writer.distribution
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Zulassungsinhaberin', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Zeller Medical AG, 8590 Romanshorn."
assert_equal(expected, paragraph.text)
end
def test_date1
chapter = @@writer.date
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
expected = "Diese Packungsbeilage wurde im Februar 2005 letztmals durch "
expected << "die Arzneimittelbehörde (Swissmedic) geprüft."
assert_equal(expected, section.paragraphs.first.text)
end
end
class TestPatinfoHpricotCimifeminFr <Minitest::Test
def setup
return if defined?(@@path) and defined?(@@patinfo) and @@patinfo
@@path = File.expand_path('data/html/fr/cimifemin.html',
File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@writer.extract(Hpricot(fh))
}
end
def test_name2
assert_equal('Cimifemine®', @@writer.name.to_s)
end
def test_company2
chapter = @@writer.company
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('ZELLER MEDICAL', chapter.heading)
end
def test_amzv2
chapter = @@writer.amzv
assert_instance_of(ODDB::Text::Chapter, chapter)
assert_equal('OEMéd', chapter.heading)
assert_equal(0, chapter.sections.size)
end
def test_composition2
chapter = @@writer.composition
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Que contient Cimifemine?', chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "1 comprimé contient: 0,018–0,026 ml extrait liquide de rhizome "
expected << "de Cimicifuga (actée à grappes), (RDE: 0,78–1,14:1), agent "
expected << "d’extraction: isopropanol 40% (v/v)."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "Cette préparation contient en outre des excipients."
assert_equal(expected, paragraph.text)
end
end
class TestPatinfoHpricotInderalDe <Minitest::Test
def setup
return if defined?(@@path) and defined?(@@patinfo) and @@patinfo
@@path = File.expand_path('data/html/de/inderal.html',
File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@patinfo = @@writer.extract(Hpricot(fh))
}
end
def test_galenic_form3
assert_nil(@@writer.galenic_form)
end
def test_contra_indications3
chapter = @@writer.contra_indications
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wann darf Inderal nicht angewendet werden?',
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(3, section.paragraphs.size)
end
def test_precautions3
chapter = @@writer.precautions
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wann ist bei der Einnahme von Inderal Vorsicht geboten?',
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(12, section.paragraphs.size)
end
def test_pregnancy3
chapter = @@writer.pregnancy
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Darf Inderal während einer Schwangerschaft oder in der Stillzeit eingenommen werden?',
chapter.heading)
assert_equal(1, chapter.sections.size)
section = chapter.sections.first
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
end
end
class TestPatinfoHpricotPonstanDe <Minitest::Test
def setup
@@path = File.expand_path('data/html/de/ponstan.html',
File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@patinfo = @@writer.extract(Hpricot(fh))
}
end
def test_composition4
chapter = @@writer.composition
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist in Ponstan enthalten?', chapter.heading)
assert_equal(5, chapter.sections.size)
section = chapter.sections.at(0)
assert_equal("", section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "Wirkstoff: Mefenaminsäure."
assert_equal(expected, paragraph.text)
section = chapter.sections.at(1)
assert_equal("Filmtabletten\n", section.subheading)
assert_equal(1, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "500 mg Mefenaminsäure sowie Vanillin (Aromaticum) und andere "
expected << "Hilfsstoffe."
assert_equal(expected, paragraph.text)
section = chapter.sections.last
assert_equal("Suspension\n", section.subheading)
assert_equal(2, section.paragraphs.size)
paragraph = section.paragraphs.at(0)
expected = "5 ml enthalten 50 mg Mefenaminsäure, Konservierungsmittel: "
expected << "Natriumbenzoat (E 211), Saccharin, Vanillin, Aromatica und "
expected << "andere Hilfsstoffe."
assert_equal(expected, paragraph.text)
paragraph = section.paragraphs.at(1)
expected = "5 ml enthalten 1 g Zucker (0,1 Brotwert)."
assert_equal(expected, paragraph.text)
end
end
class TestPatinfoHpricotNasivinDe <Minitest::Test
StylesNasivin = '<style>p{margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0pt;}table{border-spacing:0pt;border-collapse:collapse;} table td{vertical-align:top;}.s2{font-size:11pt;font-weight:bold;}.s3{font-family:Arial;font-size:12pt;line-height:150%;}.s4{font-size:11pt;}.s5{font-family:Arial;font-size:11pt;line-height:150%;}.s6{font-weight:bold;}.s7{font-size:11pt;font-style:italic;}</style>'
def setup
return if defined?(@@path) and defined?(@@patinfo) and @@patinfo
@@path = File.expand_path('data/html/de/nasivin.html', File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@patinfo = @@writer.extract(Hpricot(fh), :pi, 'Nasivin', StylesNasivin)
}
File.open(File.basename(@@path.sub('.html','.yaml')), 'w+') { |fi| fi.puts @@patinfo.to_yaml }
end
def test_composition5
# assert_nil(/- :italic/.match(@@fachinfo.to_yaml))
chapter = @@writer.effects
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist Nasivin und wann wird es angewendet?', chapter.heading)
section = chapter.sections.first
assert_instance_of(ODDB::Text::Section, section )
assert_equal('', section.subheading)
chapter = @@writer.composition
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Was ist in Nasivin enthalten?', chapter.heading)
chapter = @@writer.packages
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal('Wo erhalten Sie Nasivin? Welche Packungen sind erhältlich?', chapter.heading)
section = chapter.sections.first
paragraph = section.paragraphs.first
assert_instance_of(ODDB::Text::Paragraph, paragraph )
assert_equal("In Apotheken und Drogerien ohne ärztliche Verschreibung:",
paragraph.text)
chapter = @@writer.date
assert_instance_of(ODDB::Text::Chapter, chapter )
assert_equal("Diese Packungsbeilage wurde im Nasivin März 2007 letztmals durch die Arzneimittelbehörde (Swissmedic) geprüft.", chapter.to_s)
end
end
class TestPatinfoHpricotChapters <Minitest::Test
def test_import_chapter
testCases = [
# Test cases for specific name with ',' or special signs
['7620','Wann wird Notakehl Salbe angewendet?'],
['7620','Wann wird Traumeel, Salbe angewendet?'],
['7680','Wann darf Notakeh D3, Salbe nicht oder nur mit Vorsicht angewendet werden?'],
['7680','Wann darf Notakehl® D3, Salbe nicht oder nur mit Vorsicht angewendet werden?'],
['0', 'Information für Patientinnen und Patienten'],
['0', 'Information destinée aux patients'],
['9010', 'Name des Präparates'],
['9010', 'Name des Präparates, Homöopathisches Arzneimittel (Homöopathisch-spagyrisches'],
['9010', 'Arzneimittel)'],
['9010', 'Name des Präparates, Anthroposophisches Arzneimittel'],
['9010', 'Name des Präparates, Arzneimittel auf Grundlage anthroposophischer Erkenntnis'],
['9010', 'Name des Präparates, Pflanzliches Arzneimittel'],
['9010', 'Kurzcharakteristikum'],
['9010', 'Homöopathisches Arzneimittel (Homöopathisch-spagyrisches Arzneimittel)'],
['9010', 'Anthroposophisches Arzneimittel'],
['9010', 'Arzneimittel auf Grundlage anthroposophischer Erkenntnis'],
['9010', 'Pflanzliches Arzneimittel'],
['9010', 'Nom de la préparation'],
['9010', 'Nom de la préparation, Médicament homéopathique (médicamenthoméopathique-spagyrique)'],
['9010', 'Nom de la préparation, Médicament anthroposophique'],
['9010', 'Nom de la préparation, Médicament basé sur les connaissances anthroposophiques'],
['9010', 'Nom de la préparation, Médicament phytothérapeutique'],
['9010', 'Caractéristique à court'],
['9010', 'Médicament homéopathique (médicament homéopathique-spagyrique)'],
['9010', 'Médicament anthroposophique'],
['9010', 'Médicament basé sur les connaissances anthroposophiques'],
['9010', 'Médicament phytothérapeutique'],
['7620', 'Was ist PLATZHALTER_MEDI und wann wird es angewendet?'],
['7620', 'Was sind PLATZHALTER_MEDI und wann werden sie angewendet?'],
['7620', 'Qu’est-ce que le PLATZHALTER_MEDI et quand doit-il être utilisé?'],
['7620', "Qu’est-ce que l' PLATZHALTER_MEDI et quand doit-il être utilisé?"],
['7620', 'Qu’est-ce que la PLATZHALTER_MEDI et quand doit-elle être utilisée?'],
['7620', "Qu’est-ce que l' PLATZHALTER_MEDI et quand doit-elle être utilisée?"],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand doit-il être utilisé?'],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand doit-elle être utilisée?'],
['7620', 'Qu’est-ce que les PLATZHALTER_MEDI et quand doivent-ils être utilisés?'],
['7620', 'Qu’est-ce que les PLATZHALTER_MEDI et quand doivent-elles être utilisées?'],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand doivent-ils être utilisés?'],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand doivent-elles être utilisées?'],
['7620', 'Wann wird PLATZHALTER_MEDI angewendet?'],
['7620', 'Wann werden PLATZHALTER_MEDI angewendet?'],
['7620', 'Quand PLATZHALTER_MEDI est-il utilisé?'],
['7620', 'Quand PLATZHALTER_MEDI est-elle utilisée?'],
['7620', 'Quand PLATZHALTER_MEDI sont-ils utilisés?'],
['7620', 'Quand PLATZHALTER_MEDI sont-elles utilisées?'],
['7620', 'Qu’est-ce que le PLATZHALTER_MEDI et quand est-il utilisé?'],
['7620', "Qu’est-ce que l' PLATZHALTER_MEDI et quand est-il utilisé?"],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand est-il utilisé?'],
['7620', 'Qu’est-ce que la PLATZHALTER_MEDI et quand est-elle utilisée?'],
['7620', "Qu’est-ce que l' PLATZHALTER_MEDI et quand est-elle utilisée?"],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand est-elle utilisée?'],
['7620', 'Qu’est-ce que les PLATZHALTER_MEDI et quand sont-ils utilisés?'],
['7620', 'Qu’est-ce que les PLATZHALTER_MEDI et quand sont-elles utilisées?'],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand sont-ils utilisés?'],
['7620', 'Qu’est-ce que PLATZHALTER_MEDI et quand sont-elles utilisées?'],
['7640', 'Was sollte dazu beachtet werden?'],
['7640', 'De quoi faut-il tenir compte en dehors du traitement?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht eingenommen/angewendet werden?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht eingenommen werden?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht angewendet werden?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-il pas être pris/utilisé?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être prise/utilisée?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-il pas être pris?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-il pas être utilisé?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être prise?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être utilisée?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht eingenommen/angewendet werden?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht eingenommen werden?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht angewendet werden?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht oder nur mit Vorsicht eingenommen/angewendet werden?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht oder nur mit Vorsicht eingenommen werden?'],
['7680', 'Wann darf PLATZHALTER_MEDI nicht oder nur mit Vorsicht angewendet werden?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht oder nur mit Vorsicht eingenommen/angewendet werden?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht oder nur mit Vorsicht eingenommen werden?'],
['7680', 'Wann dürfen PLATZHALTER_MEDI nicht oder nur mit Vorsicht angewendet werden?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être pris/utilisés?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être prises/utilisées?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être pris?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être prises?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être utilisés?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être utilisées?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-il pas être pris/utilisé ou seulement avprécaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être prise/utilisée ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-il pas être pris ou seulement avec précautio?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être prise ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doit-elle pas être utilisée ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être pris/utilisés ou seulement aveprécaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être prises/utilisées ou seulemenavec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être pris ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être prises ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-ils pas être utilisés ou seulement avec précaution?'],
['7680', 'Quand PLATZHALTER_MEDI ne doivent-elles pas être utilisées ou seulement avec précaution?'],
['7700', 'Wann ist bei der Einnahme/Anwendung von PLATZHALTER_MEDI Vorsicht geboten?'],
['7700', 'Wann ist bei der Einnahme von PLATZHALTER_MEDI Vorsicht geboten?'],
['7700', 'Wann ist bei der Anwendung von PLATZHALTER_MEDI Vorsicht geboten?'],
['7700', 'Quelles sont les précautions à observer lors de la prise/de l’utilisation de PLATZHALTER_MEDI?'],
['7700', 'Quelles sont les précautions à observer lors de la prise de PLATZHALTER_MEDI?'],
['7700', 'Quelles sont les précautions à observer lors de l’utilisation de PLATZHALTER_MEDI?'],
['7720', 'Darf PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit eingenommen/angewendet werden?'],
['7720', 'Darf PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit eingenommen werden?'],
['7720', 'Darf PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit angewendet werden?'],
['7720', 'Dürfen PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit eingenommen/angewendet werden?'],
['7720', 'Dürfen PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit eingenommen werden?'],
['7720', 'Dürfen PLATZHALTER_MEDI während einer Schwangerschaft oder in der Stillzeit angewendet werden?'],
['7720', 'PLATZHALTER_MEDI peut-il être pris/utilisé pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peut-elle être prise/utilisée pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peut-il être pris pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peut-elle être prise pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peut-il être utilisé pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peut-elle être utilisée pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peuvent-ils être pris/utilisés pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peuvent-elles être prises/utilisées pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peuvent-ils être pris pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peuvent-elles être prises pendant la grossesse ou l’allaitement?'],
['7720', 'PLATZHALTER_MEDI peuvent-ils être utilisés pendant la grossesse ou l’allaitement?'],
['7720', ' PLATZHALTER_MEDI peuvent-elles être utilisées pendant la grossesse ou l’allaitement?'],
['7740', 'Wie verwenden Sie PLATZHALTER_MEDI?'],
['7740', 'Comment utiliser PLATZHALTER_MEDI?'],
['7760', 'Welche Nebenwirkungen kann PLATZHALTER_MEDI haben?'],
['7760', 'Welche Nebenwirkungen können PLATZHALTER_MEDI haben?'],
['7760', 'Quels effets secondaires PLATZHALTER_MEDI peut-il provoquer?'],
['7760', 'Quels effets secondaires PLATZHALTER_MEDI peut-elle provoquer?'],
['7760', 'Quels effets secondaires PLATZHALTER_MEDI peuvent-ils provoquer?'],
['7760', 'Quels effets secondaires PLATZHALTER_MEDI peuvent-elles provoquer?'],
['7780', 'Was ist ferner zu beachten?'],
['7780', 'A quoi faut-il encore faire attention?'],
['7780', 'À quoi faut-il encore faire attention?'],
['7840', 'Was ist in PLATZHALTER_MEDI enthalten?'],
['7840', 'Que contient PLATZHALTER_MEDI?'],
['7860', 'Zulassungsnummer'],
['7860', 'Numéro d’autorisation'],
['7880', 'Wo erhalten Sie PLATZHALTER_MEDI? Welche Packungen sind erhältlich?'],
['7880', 'Que contiennent PLATZHALTER_MEDI?'],
['7880', 'Où obtenez-vous PLATZHALTER_MEDI? Quels sont les emballages à disposition sur le marché?'],
['9000', 'Zulassungsinhaberin'],
['9000', 'Titulaire de l’autorisation'],
['7920', 'Herstellerin'],
['7920', 'Fabricant'],
['7940', 'Diese Packungsbeilage wurde im PLATZHALTER_MEDI (Monat/Jahr) letztmals durch die Arzneimittelbehörde (Swissmedic) geprüft.'],
['7940', 'Cette notice d’emballage a été vérifiée pour la dernière foisen PLATZHALTER_MEDI (mois/année) par l’autorité de contrôle des médicaments (Swissmedic).'],
]
nrFailures = 0
testCases.each{
|tc|
unless tc == res = ODDB::FiParse::PatinfoHpricot::text_to_chapter(tc[1])
$stdout.puts "Parsing chapter #{tc[1]} failed, returned #{res[0]} != #{tc[0]}"
nrFailures += 1
end
}
skip("Niklaus has no priority to bring the nrFailures down to 0 from 31")
assert_equal nrFailures, 0
end
end
class TestPatinfoHpricot_30785_PonstanDe <Minitest::Test
CourierStyle = '<PRE style="font-family: Courier New, monospace; font-size: 12px;">'
StylesPonstan = 'p{margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0pt;}table{border-spacing:0pt;border-collapse:collapse;} table td{vertical-align:top;}.s2{font-family:Arial;font-size:16pt;font-weight:bold;}.s3{line-height:115%;text-align:justify;}.s4{font-family:Arial;font-size:11pt;font-style:italic;font-weight:bold;}.s5{line-height:115%;text-align:right;margin-top:18pt;padding-top:2pt;padding-bottom:2pt;border-top-width:0.5pt;border-top-color:#000000;border-top-style:solid;border-bottom-width:0.5pt;border-bottom-color:#000000;border-bottom-style:solid;}.s6{font-family:Arial;font-size:12pt;font-style:italic;font-weight:bold;}.s7{line-height:115%;text-align:justify;margin-top:8pt;}.s8{font-family:Arial;font-size:11pt;}.s9{line-height:115%;text-align:justify;margin-top:2pt;}.s10{line-height:115%;text-align:justify;margin-top:6pt;}.s11{font-family:Arial;font-size:11pt;font-style:italic;}.s12{font-family:Courier New;font-size:11pt;}.s13{line-height:115%;text-align:left;}.s14{height:6pt;}.s15{font-family:Courier;margin-left:0pt;padding-top:2.25pt;padding-right:2.25pt;padding-bottom:3.75pt;padding-left:3.75pt;border-top-width:0.5pt;border-top-color:#000000;border-top-style:solid;}.s16{font-family:Courier;margin-left:0pt;padding-top:2.25pt;padding-right:2.25pt;padding-bottom:3.75pt;padding-left:3.75pt;}.s17{font-family:Courier;margin-left:0pt;padding-top:2.25pt;padding-right:2.25pt;padding-bottom:3.75pt;padding-left:3.75pt;border-bottom-width:0.5pt;border-bottom-color:#000000;border-bottom-style:solid;}.s18{font-family:Courier;margin-top:2pt;margin-left:-5.4pt;padding-top:0pt;padding-right:5.4pt;padding-bottom:0pt;padding-left:5.4pt;}.s19{font-family:Arial;font-size:11pt;font-weight:bold;}'
def setup
return if defined?(@@path) and defined?(@@patinfo) and @@patinfo
@@path = File.expand_path('data/html/de/pi_30785_ponstan.html', File.dirname(__FILE__))
@@writer = PatinfoHpricot.new
open(@@path) { |fh|
@@patinfo = @@writer.extract(Hpricot(fh), :pi, 'Ponstan', StylesPonstan)
}
File.open(File.basename(@@path.sub('.html','.yaml')), 'w+') { |fi| fi.puts @@patinfo.to_yaml }
end
def test_all_to_html
@lookandfeel = FlexMock.new 'lookandfeel'
@lookandfeel.should_receive(:section_style).and_return { 'section_style' }
@session = FlexMock.new '@session'
@session.should_receive(:lookandfeel).and_return { @lookandfeel }
@session.should_receive(:user_input)
assert(@session.respond_to?(:lookandfeel))
@view = View::Chapter.new(:name, nil, @session)
@view.value = @@patinfo.usage
result = @view.to_html(CGI.new)
expected = [ /Wie verwenden Sie Ponstan?/, # heading
/Alter Suspension Kapseln Zäpfchen/,
/>Alter Suspension Kapseln Zäpfchen \n/,
/<PRE/,
/#{CourierStyle}Alter Suspension Kapseln Zäpfchen \n/,
]
File.open(File.basename(@@path), 'w+') { |x| x.puts("<HTML><BODY>"); x.write(result); x.puts("</HTML></BODY>");}
expected.each { |pattern|
assert(pattern.match(result), "Missing pattern:\n#{pattern}\nin:\n#{result}")
}
end
end
end
end