Class: TestFachinfoDocParser4

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



244
245
246
247
248
249
250
251
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 244

def setup
  @filename = File.expand_path('data/doc/felodil_12_01.doc', 
    File.dirname(__FILE__))
  @text_handler = ODDB::FiParse::FachinfoTextHandler.new
  @parser = Rwv2.create_parser(@filename)
  @parser.set_text_handler(@text_handler)
  @parser.parse
end

- (Object) test_composition4



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 259

def test_composition4
  writer = @text_handler.writers.first
  chapter = writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zusammensetzung', chapter.heading)
  assert_equal(2, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal('a) Wirkstoff:', section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
  assert_equal('Felodipin',paragraph.text)
  section = chapter.sections.at(1)
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal('b) Hilfsstoffe:', section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
  assert_equal('Excipiens pro compresso obducto.',paragraph.text)
end

- (Object) test_effects4



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 305

def test_effects4
  writer = @text_handler.writers.first
  chapter = writer.effects
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Eigenschaften / Wirkungen', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal('', section.subheading)
  assert_equal(19, section.paragraphs.size)
  paragraph = section.paragraphs.at(17)
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
  expected = /In der HOT\-Studie \(Hypertension Optimal Treatment\) wurde Felodipin entweder als Monotherapie oder bei Bedarf in Kombination mit b\-Blockern und\/oder ACE\-Hemmern und\/oder Diuretika verabreicht. Die Wirkung auf die .*ufigsten kardiovasku.*ren Ereignisse \(z\.B\. akuter Myokardinfarkt, Herzschlag und Herztod\) wurde in Beziehung zu den angestrebten diastolischen Blutdruck\-Werten untersucht\. Insgesamt wurden 18 790 Patienten mit an.*nglichen diastolischen Blutdruck\-Werten von 100\-115 mmHg im Alter zwischen 50\-80 Jahren .*hrend durchschnittlich 3,8 \(Bereich 3,3\-4,9\) Jahren in die Studie miteinbezogen\./ 
  assert_match(expected, paragraph.text)
end

- (Object) test_galenic_form_de4



280
281
282
283
284
285
286
287
288
289
290
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 280

def test_galenic_form_de4
  writer = @text_handler.writers.first
  chapter = writer.galenic_form
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Galenische Form und Wirkstoffmenge pro Einheit', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal("", section.subheading)
  assert_equal(2, section.paragraphs.size)
end

- (Object) test_iksnrs4



320
321
322
323
324
325
326
327
328
329
330
331
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 320

def test_iksnrs4
  writer = @text_handler.writers.first
  chapter = writer.iksnrs
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zulassungsvermerk', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  result = paragraph.text
  assert_match(/56.*170/, result)
end

- (Object) test_indications4



291
292
293
294
295
296
297
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 291

def test_indications4
  writer = @text_handler.writers.first
  chapter = writer.indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Indikationen \/ Anwendungsm.*glichkeiten/, chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_name4



252
253
254
255
256
257
258
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 252

def test_name4
  assert_equal(2, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_match(/Felodil.* 5\/10\n/, writer.name)
  writer = @text_handler.writers.last
  assert_match(/Felodil.* 5\/10\n/, writer.name)
end

- (Object) test_registration_owner4



332
333
334
335
336
337
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 332

def test_registration_owner4
  writer = @text_handler.writers.first
  chapter = writer.registration_owner
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zulassungsinhaberin', chapter.heading)
end

- (Object) test_usage4



298
299
300
301
302
303
304
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 298

def test_usage4
  writer = @text_handler.writers.first
  chapter = writer.usage
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Dosierung / Anwendung', chapter.heading)
  assert_equal(5, chapter.sections.size)
end