# # test/unit/bio/db/kegg/test_drug.rb - Unit test for Bio::KEGG::DRUG # # Copyright:: Copyright (C) 2009 Naohisa Goto # License:: The Ruby License # # loading helper routine for testing bioruby require 'pathname' load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'bioruby_test_helper.rb')).cleanpath.to_s # libraries needed for the tests require 'test/unit' require 'bio/db/kegg/drug' module Bio class TestBioKeggDRUG < Test::Unit::TestCase def setup filename = File.join(BioRubyTestDataPath, 'KEGG/D00063.drug') @obj = Bio::KEGG::DRUG.new(File.read(filename)) end def test_dblinks_as_hash expected = { "ChEBI"=>["28864"], "PubChem"=>["7847131"], "NIKKAJI"=>["J4.533K"], "PDB-CCD"=>["TOY"], "DrugBank"=>["DB00684"], "LigandBox"=>["D00063"], "CAS"=>["32986-56-4"] } assert_equal(expected, @obj.dblinks_as_hash) assert_equal(expected, @obj.dblinks) end def test_pathways_as_hash expected = {"map07021"=>"Aminoglycosides"} assert_equal(expected, @obj.pathways_as_hash) assert_equal(expected, @obj.pathways) end def test_entry_id assert_equal("D00063", @obj.entry_id) end def test_names expected = [ "Tobramycin (JP15/USP)", "TOB", "Tobracin (TN)", "Tobrex (TN)" ] assert_equal(expected, @obj.names) end def test_name expected = "Tobramycin (JP15/USP)" assert_equal(expected, @obj.name) end def test_formula assert_equal("C18H37N5O9", @obj.formula) end def test_mass assert_equal(467.2591, @obj.mass) end def test_activity expected = "Antibacterial" assert_equal(expected, @obj.activity) end def test_remark expected = "Same as: C00397 Therapeutic category: 1317 6123 ATC code: J01GB01 S01AA12" assert_equal(expected, @obj.remark) end def test_pathways_as_strings expected = [ "PATH: map07021 Aminoglycosides" ] assert_equal(expected, @obj.pathways_as_strings) end def test_dblinks_as_strings expected = [ "CAS: 32986-56-4", "PubChem: 7847131", "ChEBI: 28864", "DrugBank: DB00684", "PDB-CCD: TOY", "LigandBox: D00063", "NIKKAJI: J4.533K" ] assert_equal(expected, @obj.dblinks_as_strings) end def test_kcf expected = <