Sha256: 03d5d16653342dc28a77101dda7c649d69413cbb98d2c7fd2ac86075f56189a0

Contents?: true

Size: 1.75 KB

Versions: 18

Compression:

Stored size: 1.75 KB

Contents

#
# test/unit/bio/test_db.rb - Unit test for Bio::DB
#
# Copyright::  Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
# License::    The Ruby License
#
#  $Id: test_db.rb,v 1.4 2007/04/05 23:35:42 trevor Exp $
#

require 'pathname'
libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)

require 'test/unit'
require 'bio/db'

module Bio
  class TestDB < Test::Unit::TestCase
    def setup
      
     @obj = Bio::DB.new
      @obj.instance_eval { @orig = {"TAG" => "TAG value1\n    value2"} }
    end

    def test_open
      assert(Bio::DB.respond_to?(:open))
    end
 
    def test_entry_id
      assert_raises(NotImplementedError) { @obj.entry_id }
    end

    def test_tags
      assert_equal(["TAG"], @obj.tags)
    end
    
    def test_exists
      assert_equal(true, @obj.exists?("TAG"))
    end

    def test_get
      assert_equal("TAG value1\n    value2", @obj.get("TAG"))
    end

    def test_fetch
      assert(@obj.fetch("TAG"))
      assert(@obj.fetch("TAG", 1))
    end
  end


  class TestNCBIDB < Test::Unit::TestCase
    def setup
      entry =<<END
LOCUS     locus
END
      @obj = Bio::NCBIDB.new(entry, 10)
    end

    def test_fetch
      assert_equal('locus', @obj.fetch("LOCUS"))
    end

    def test_p_toptag2array
    end

    def test_p_subtag2array
    end

    def test_p_entry2hash
    end
  end

#  class TestKEGGDB < Test::Unit::TestCase
#  end
  
  class TestEMBLDB < Test::Unit::TestCase
    def setup
      @entry =<<END
ID id
XX
CC cc1
CC cc2
END
      @obj = Bio::EMBLDB.new(@entry, 2)
    end

    def test_fetch
      assert_equal('id', @obj.fetch("ID"))
      assert_equal('cc1 cc2', @obj.fetch("CC"))
    end

    def test_p_entry2hash
    end
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
bioruby-bio-1.2.9.9001 test/unit/bio/test_db.rb
bioruby-bio-1.2.9.9501 test/unit/bio/test_db.rb
bioruby-bio-1.3.0.5000 test/unit/bio/test_db.rb
bioruby-bio-1.3.0.9901 test/unit/bio/test_db.rb
bioruby-bio-1.3.0 test/unit/bio/test_db.rb
bioruby-bio-1.3.1.5000 test/unit/bio/test_db.rb
jandot-bio-1.2.1 test/unit/bio/test_db.rb
ngoto-bio-1.2.9.9001 test/unit/bio/test_db.rb
ngoto-bio-1.2.9.9501 test/unit/bio/test_db.rb
ngoto-bio-1.3.0.5000 test/unit/bio/test_db.rb
ngoto-bio-1.3.0 test/unit/bio/test_db.rb
ngoto-bio-1.3.1.5000 test/unit/bio/test_db.rb
wwood-bioruby-1.2.11 test/unit/bio/test_db.rb
bio-1.3.1 test/unit/bio/test_db.rb
bio-1.2.0 test/unit/bio/test_db.rb
bio-1.2.1 test/unit/bio/test_db.rb
bio-1.1.0 test/unit/bio/test_db.rb
bio-1.3.0 test/unit/bio/test_db.rb