Class: TestFachinfoDocParser2

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

Defined Under Namespace

Classes: StubTabDescriptor

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



188
189
190
191
192
193
194
195
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 188

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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 196

def test_effects2
  writer = @text_handler.writers.first
  chapter = writer.effects
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Eigenschaften/Wirkungen', chapter.heading)
  assert_equal(3, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal('', section.subheading)
  assert_equal(6, section.paragraphs.size)
  paragraph = section.paragraphs.at(2)
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
  expected = "------------------------------------------------------------------------\nDisktest (10 \265g)\nDurchmesser (mm)\nsensibel      intermedi\344r   resistent\n-------------------------------------------------------------------------\nStaphylokokken       > 29        -            < 28\nEnterokokken         > 17        -            < 16\nStreptokokken        > 30      22-29          < 21\nListeria mono-\nCytogenes            > 20        -            < 19\nGram-negative\nDarmbakterien        > 17      14-16          < 13\nHaemophilus          > 22      19-21          < 18\n------------------------------------------------------------------------\nVerd\374nnungstest\nMHK (mg/l)\nsensibel      resistent\n-------------------------------------------------------------------------\nStaphylokokken                 < 0,25       Penicil-\nlinase\nEnterokokken                     -            > 16\nStreptokokken                  < 0,12          > 4\nListeria monocytogenes          < 2            > 4\nGram-negative Darm-\nBakterien                       < 8           > 32\nHaemophilus                     < 1            > 4\n------------------------------------------------------------------------\n"
  txt = paragraph.text
  expected = /\-+\n +Disktest \(10 .*g\)\n +Durchmesser \(mm\)\n +sensibel +.* +resistent\n\-+\nStaphylokokken +\> 29 +\- +\< 28\nEnterokokken +\> 17 +\- +\< 16\nStreptokokken +\> 30 +22\-29 +\< 21\nListeria mono\-\nCytogenes +\> 20 +\- +\< 19\nGram-negative\nDarmbakterien +\> 17 +14\-16 +\< 13\nHaemophilus +\> 22 +19\-21 +\< 18\n\-+\n +Ver.*nungstest\n +MHK \(mg\/l\)\n +sensibel      resistent\n\-+\nStaphylokokken +\< 0,25 +Penicil\-\n +linase\nEnterokokken +\- +\> 16\nStreptokokken +\< 0,12 +\> 4\nListeria monocytogenes +\< 2 +\> 4\nGram\-negative Darm\-\nBakterien +\< 8 +\> 32\nHaemophilus +\< 1 +\> 4\n\-+/
  assert_match(expected, txt)
end