Class: TestFachinfoDocParser5

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



340
341
342
343
344
345
346
347
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 340

def setup
  @filename = File.expand_path('data/doc/Calcitriol_d_10.03.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_company5



353
354
355
356
357
358
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 353

def test_company5
  writer = @text_handler.writers.first
  chapter = writer.company
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal("Salmon Pharma", chapter.heading)
end

- (Object) test_composition5



359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 359

def test_composition5
  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('Wirkstoff:', section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
end

- (Object) test_galenic_form5



372
373
374
375
376
377
378
379
380
381
382
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 372

def test_galenic_form5
  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("Kapseln\n", section.subheading)
  assert_equal(1, section.paragraphs.size)
end

- (Object) test_iksnrs5



397
398
399
400
401
402
403
404
405
406
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 397

def test_iksnrs5
  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)
  assert_equal(1, chapter.sections.first.paragraphs.size)
  paragraph = chapter.sections.first.paragraphs.first
  assert_equal("55950 (Swissmedic)", paragraph.text)
end

- (Object) test_indications5



383
384
385
386
387
388
389
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 383

def test_indications5
  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_name5



348
349
350
351
352
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 348

def test_name5
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_equal("Calcitriol Salmon Pharma\n", writer.name)
end

- (Object) test_packages5



428
429
430
431
432
433
434
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 428

def test_packages5
  writer = @text_handler.writers.first
  chapter = writer.packages
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Packungen', chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_pregnancy5



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 413

def test_pregnancy5
  writer = @text_handler.writers.first
  chapter = writer.pregnancy
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Schwangerschaft/Stillzeit', chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_equal('', section.subheading)
  paragraph = section.paragraphs.at(1)
  expected = /Tierexperimentelle Studien haben eine Fetotoxizit.*t gezeigt \(s\..*Pr.*klinische Daten.*\)\./
  assert_match(expected, paragraph.text)
  paragraph = section.paragraphs.at(2)
  expected = /Es gibt keine Hinweise daf.*r\, dass Vitamin D .* selbst in sehr hohen Dosen .* beim Menschen teratogen wirkt\. Calcitriol Salmon Pharma sollte w.*hrend der Schwangerschaft nur dann angewandt werden\, wenn dies klar notwendig ist\./
  assert_match(expected, paragraph.text)
end

- (Object) test_registration_owner5



407
408
409
410
411
412
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 407

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

- (Object) test_usage5



390
391
392
393
394
395
396
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 390

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