Class: ODDB::FiParse::TestFachinfoHpricotAlcaCDe

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/fiparse/test/test_fachinfo_hpricot.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



71
72
73
74
75
76
77
78
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 71

def setup
  @path = File.expand_path('data/html/de/alcac.fi.html', 
    File.dirname(__FILE__))
  @writer = FachinfoHpricot.new
  open(@path) { |fh| 
    @fachinfo = @writer.extract(Hpricot(fh))
  }
end

#test_amzv1Object



97
98
99
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 97

def test_amzv1
  assert_nil @writer.amzv
end

#test_company1Object



85
86
87
88
89
90
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 85

def test_company1
  ## this is unused. Since it's part of the base-class TextinfoHpricot, let's test it.
  chapter = @writer.company
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('NOVARTIS CONSUMER HEALTH', chapter.heading)
end

#test_composition1Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 100

def test_composition1
  chapter = @fachinfo.composition
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Zusammensetzung', 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 =  "Wirkstoffe:"
  assert_equal(expected, paragraph.text)
  paragraph = section.paragraphs.at(1)
  expected =  /1 Brausetablette enth.*lt: Carbasalatum calcicum 528.*mg corresp. Acidum Acetylsalicylicum 415.*mg, Acidum ascorbicum 250.*mg./
  assert_match(expected, paragraph.text)
  paragraph = section.paragraphs.at(2)
  expected =  /Hilfsstoffe: Saccharinum, Cyclamas, Aromatica, Color.: E.*120\./
  assert_match(expected, paragraph.text)
end

#test_date1Object



168
169
170
171
172
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 168

def test_date1
  chapter = @fachinfo.date
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Stand der Information', chapter.heading)
end

#test_effects1Object



118
119
120
121
122
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 118

def test_effects1
  chapter = @fachinfo.effects
  assert_instance_of(ODDB::Text::Chapter, chapter )
  assert_equal('Eigenschaften/Wirkungen', chapter.heading)
end

#test_fachinfo1Object



79
80
81
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 79

def test_fachinfo1
  assert_instance_of(FachinfoDocument, @fachinfo)
end

#test_galenic_form1Object



91
92
93
94
95
96
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 91

def test_galenic_form1
  chapter = @fachinfo.galenic_form
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Antipyretikum/Analgetikum mit Vitamin C', chapter.heading)
  assert_equal(0, chapter.sections.size)
end

#test_iksnrs1Object



163
164
165
166
167
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 163

def test_iksnrs1
  chapter = @fachinfo.iksnrs
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('IKS-Nummern', chapter.heading)
end

#test_indications1Object



128
129
130
131
132
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 128

def test_indications1
  chapter = @fachinfo.indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Indikationen/Anwendungsmöglichkeiten', chapter.heading)
end

#test_interactions1Object



148
149
150
151
152
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 148

def test_interactions1
  chapter = @fachinfo.interactions
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Interaktionen', chapter.heading)
end

#test_kinetic1Object



123
124
125
126
127
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 123

def test_kinetic1
  chapter = @fachinfo.kinetic
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Pharmakokinetik', chapter.heading)
end

#test_name1Object



82
83
84
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 82

def test_name1
  assert_equal('Alca-C®', @fachinfo.name)
end

#test_other_advice1Object



158
159
160
161
162
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 158

def test_other_advice1
  chapter = @fachinfo.other_advice
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Sonstige Hinweise', chapter.heading)
end

#test_overdose1Object



153
154
155
156
157
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 153

def test_overdose1
  chapter = @fachinfo.overdose
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Überdosierung', chapter.heading)
end

#test_restrictions1Object



138
139
140
141
142
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 138

def test_restrictions1
  chapter = @fachinfo.restrictions
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Anwendungseinschränkungen', chapter.heading)
end

#test_unwanted_effects1Object



143
144
145
146
147
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 143

def test_unwanted_effects1
  chapter = @fachinfo.unwanted_effects
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Unerwünschte Wirkungen', chapter.heading)
end

#test_usage1Object



133
134
135
136
137
# File 'ext/fiparse/test/test_fachinfo_hpricot.rb', line 133

def test_usage1
  chapter = @fachinfo.usage
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Dosierung/Anwendung', chapter.heading)
end