Class: TestFachinfoDocParser12

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

Defined Under Namespace

Classes: ReplHandler

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1154

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



1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1172

def test_composition12
  writer = @text_handler.writers.first
  chapter = writer.composition
  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_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
end

- (Object) test_galenic_form12



1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1184

def test_galenic_form12
  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("1 capsule contient :\n", section.subheading)
  assert_equal(1, section.paragraphs.size)
end

- (Object) test_iksnrs12



1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1203

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

- (Object) test_indications12



1196
1197
1198
1199
1200
1201
1202
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1196

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

- (Object) test_name12



1167
1168
1169
1170
1171
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1167

def test_name12
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_equal("Yakona-Hypericum\n", writer.name)
end

- (Object) test_registration_owner12



1213
1214
1215
1216
1217
1218
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1213

def test_registration_owner12
  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