Class: TestFachinfoDocParser8

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

Overview

class TestFachinfoDocParser7 < Test::Unit::TestCase

  def setup
    @filename = File.expand_path('data/doc/Flectoparin_d_08.doc', 
      File.dirname(__FILE__))
    @text_handler = ODDB::FiParse::FachinfoTextHandler.new
    @parser = Rwv2.create_parser(@filename)
    @parser.set_text_handler(@text_handler)
    @table_handler = @text_handler.table_handler
    @parser.set_table_handler(@table_handler)
    @parser.parse
    @text_handler.cutoff_fontsize = 28
    @parser.parse
  end
  def test_name7
    assert_equal(1, @text_handler.writers.size)
    writer = @text_handler.writers.first
    #puts writer.inspect
    assert_equal("Flectoparin Tissugel\n", writer.name)
  end
  def test_composition7
    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('Wirkstoffe:', section.subheading)
    assert_equal(1, section.paragraphs.size)
    paragraph = section.paragraphs.first
    assert_instance_of(ODDB::Text::Paragraph, paragraph)
  end
  def test_galenic_form7
    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
  def test_indications7
    writer = @text_handler.writers.first
    chapter = writer.indications
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Indikationen/Anwendungsmöglichkeiten', chapter.heading)
    assert_equal(1, chapter.sections.size)
  end
  def test_usage7
    writer = @text_handler.writers.first
    chapter = writer.usage
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Dosierung/Anwendung', chapter.heading)
    assert_equal(2, chapter.sections.size)
  end
  def test_contra_indiations7
    writer = @text_handler.writers.first
    chapter = writer.contra_indications
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Kontraindikationen', chapter.heading)
    assert_equal(1, chapter.sections.size)
  end
  def test_restrictions7
    writer = @text_handler.writers.first
    chapter = writer.restrictions
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Warnhinweise und Vorsichtsmassnahmen', chapter.heading)
    assert_equal(1, chapter.sections.size)
  end
  def test_interactions7
    writer = @text_handler.writers.first
    chapter = writer.interactions
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Interaktionen', chapter.heading)
    assert_equal(1, chapter.sections.size)
  end
  def test_pregnancy7
    puts @table_handler.inspect
    flunk
    writer = @text_handler.writers.first
    chapter = writer.pregnancy
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Schwangerschaft/Stillzeit', chapter.heading)
    assert_equal(5, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_driving_ability7
    writer = @text_handler.writers.first
    chapter = writer.driving_ability
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Wirkung auf die Fahrtüchtigkeit und auf das Bedienen von Maschinen',
                 chapter.heading)
    assert_equal(1, chapter.sections.size)
  end
  def test_unwanted_effects7
    writer = @text_handler.writers.first
    chapter = writer.unwanted_effects
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Unerwünschte Wirkungen', chapter.heading)
    assert_equal(3, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_overdose7
    writer = @text_handler.writers.first
    chapter = writer.overdose
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Überdosierung', chapter.heading)
    assert_equal(1, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_effects7
    writer = @text_handler.writers.first
    chapter = writer.effects
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Eigenschaften/Wirkungen', chapter.heading)
    assert_equal(6, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_kinetic7
    writer = @text_handler.writers.first
    chapter = writer.kinetic
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Pharmakokinetik', chapter.heading)
    assert_equal(2, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_preclinic7
    writer = @text_handler.writers.first
    chapter = writer.preclinic
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Präklinische Daten', chapter.heading)
    assert_equal(1, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_other_advice7
    writer = @text_handler.writers.first
    chapter = writer.other_advice
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Sonstige Hinweise', chapter.heading)
    assert_equal(4, chapter.sections.size)
    section = chapter.sections.first
  end
  def test_iksnrs7
    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("57'347 (Swissmedic)", paragraph.text)
  end
  def test_packages7
    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)
    section = chapter.sections.first
  end
  def test_registration_owner7
    writer = @text_handler.writers.first
    chapter = writer.registration_owner
    assert_instance_of(ODDB::Text::Chapter, chapter)
    assert_equal('Zulassungsinhaberin', chapter.heading)
    assert_equal(1, chapter.sections.size)
  end

end

Defined Under Namespace

Classes: ReplHandler

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 826

def setup
  @filename = File.expand_path('data/doc/Togal_ASS_f.doc', 
    File.dirname(__FILE__))
  @text_handler = ODDB::FiParse::FachinfoTextHandler.new
  @parser = Rwv2.create_parser(@filename)
  @parser.set_text_handler(@text_handler)
  @table_handler = @text_handler.table_handler
  @parser.set_table_handler(@table_handler)
  @parser.set_inline_replacement_handler(ReplHandler.new)
  @parser.parse
  @text_handler.cutoff_fontsize = @text_handler.max_fontsize
  @parser.parse
end

- (Object) test_company8



944
945
946
947
948
949
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 944

def test_company8
  writer = @text_handler.writers.first
  chapter = writer.company
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('ARS VITAE', chapter.heading)
end

- (Object) test_composition8



844
845
846
847
848
849
850
851
852
853
854
855
856
857
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 844

def test_composition8
  writer = @text_handler.writers.first
  chapter = writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Composition', chapter.heading)
  assert_equal(2, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_match(/Principe actif.*\:/, section.subheading)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
end

- (Object) test_contra_indiations8



883
884
885
886
887
888
889
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 883

def test_contra_indiations8
  writer = @text_handler.writers.first
  chapter = writer.contra_indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Contre-indications', chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_driving_ability8



928
929
930
931
932
933
934
935
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 928

def test_driving_ability8
  writer = @text_handler.writers.first
  chapter = writer.driving_ability
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Effet sur l.*aptitude .* la conduite et .* l.*utilisation de machines/,
               chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_galenic_form8



858
859
860
861
862
863
864
865
866
867
868
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 858

def test_galenic_form8
  writer = @text_handler.writers.first
  chapter = writer.galenic_form
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Forme gal.*nique et quantit.* de principe actif par unit.+/, 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_iksnrs8



950
951
952
953
954
955
956
957
958
959
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 950

def test_iksnrs8
  writer = @text_handler.writers.first
  chapter = writer.iksnrs
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Estampille', chapter.heading)
  assert_equal(1, chapter.sections.size)
  assert_equal(1, chapter.sections.first.paragraphs.size)
  paragraph = chapter.sections.first.paragraphs.first
  assert_equal("50863 (Swissmedic).", paragraph.text)
end

- (Object) test_indications8



869
870
871
872
873
874
875
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 869

def test_indications8
  writer = @text_handler.writers.first
  chapter = writer.indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Indications\/Possibilit.*s d.*emploi/, chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_interactions8



904
905
906
907
908
909
910
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 904

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

- (Object) test_name8



839
840
841
842
843
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 839

def test_name8
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_match(/Togal.+ ASS 300\/500\n/, writer.name)
end

- (Object) test_pregnancy8



911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 911

def test_pregnancy8
  writer = @text_handler.writers.first
  chapter = writer.pregnancy
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Grossesse/Allaitement', chapter.heading)
  assert_equal(2, chapter.sections.size)
  section = chapter.sections.first
  assert_equal("Grossesse\n", section.subheading)
  paragraph = section.paragraphs.at(0)
  expected = /La prudence s.*impose lors de l.*utilisation de salicylates durant le premier et le deuxi.*me trimestres de la grossesse\. En exp.*rimentation animale, les salicylates ont montr.* des effets ind.*sirables sur le f.*tus \(tels qu.*une augmentation de la mortalit.*, des troubles de la croissance, des intoxications aux salicylates\), mais il n.*existe pas d.*tudes contr.*l.*es chez la femme enceinte\. En fonction des exp.*riences actuelles, il semble cependant que ce risque soit minime aux doses th.*rapeutiques normales\. Au cours du dernier trimestre de la grossesse, la prise de salicylates peut entra.*ner une inhibition des contractions et des h.*morragies, une prolongation de la dur.*e de la gestation et une fermeture pr.*matur.*e du canal art.*riel \(ductus arteriosus\)\. Voici pourquoi ils sont contre\-indiqu.*s\./
  assert_match(expected, paragraph.text)
  section = chapter.sections.last
  assert_equal("Allaitement\n", section.subheading)
  paragraph = section.paragraphs.at(0)
  expected = /Les salicylates passent dans le lait maternel\. La concentration dans le lait maternel est la m.*me ou m.*me plus haute que dans le plasma maternel. Aux doses habituelles utilis.*es .* court terme \(pour l.*analg.*sie et l.*action antipyr.*tique\), aucune cons.*quence nuisible pour le nourrisson n.*est .* pr.*voir. Une interruption de l.*allaitement n.*est pas n.*cessaire si le m.*dicament est utilis.* occasionnellement aux doses recommand.*es. L.*allaitement devrait .*tre interrompu si le m.*dicament est utilis.* de mani.*re prolong.*e, resp\. .* des doses plus .*lev.*es\./
  assert_match(expected, paragraph.text)
end

- (Object) test_registration_owner8



960
961
962
963
964
965
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 960

def test_registration_owner8
  writer = @text_handler.writers.first
  chapter = writer.registration_owner
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Titulaire de l.*autorisation/, chapter.heading)
end

- (Object) test_restrictions8



890
891
892
893
894
895
896
897
898
899
900
901
902
903
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 890

def test_restrictions8
  writer = @text_handler.writers.first
  chapter = writer.restrictions
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Mises en garde et pr.*cautions/, chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  paragraph = section.paragraphs.at(6)
  assert_match(/carence en glucose-6-phosphate-d.*shydrog.*nase d.*origine g.*n.*tique;/,
               paragraph.text)
  paragraph = section.paragraphs.at(7)
  assert_match(/traitement concomitant par des anticoagulants.*;/,
               paragraph.text)
end

- (Object) test_unwanted_effects8



936
937
938
939
940
941
942
943
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 936

def test_unwanted_effects8
  writer = @text_handler.writers.first
  chapter = writer.unwanted_effects
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Effets ind.*sirables/, chapter.heading)
  assert_equal(21, chapter.sections.size)
  section = chapter.sections.first
end

- (Object) test_usage8



876
877
878
879
880
881
882
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 876

def test_usage8
  writer = @text_handler.writers.first
  chapter = writer.usage
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Posologie\/Mode d.*emploi/, chapter.heading)
  assert_equal(2, chapter.sections.size)
end