Sha256: 5726e651f1f9216faef4e9db0274529fda69072e4d2bc6496f84694e15821b86

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

require 'rbbt/sources/pubmed'
require 'test/unit'

class TestPubMed < Test::Unit::TestCase

  def test_get_online
    pmid = '16438716'
    assert(PubMed.get_online(pmid) =~ /Discovering semantic features in the literature: a foundation for building functional associations./)

    pmids = ['16438716', 17204154]
    assert(PubMed.get_online(pmids)[pmid] =~ /Discovering semantic features in the literature: a foundation for building functional associations./)
  end

  def test_get_article
    pmid = '16438716'
    assert(PubMed.get_article(pmid).title == "Discovering semantic features in the literature: a foundation for building functional associations.")
    
    pmids = ['16438716', 17204154]
    assert(PubMed.get_article(pmids)[pmid].title == "Discovering semantic features in the literature: a foundation for building functional associations.")
  end
 
  def test_full_text
    pmid = '16438716'
    assert(PubMed.get_article(pmid).full_text =~ /Discovering/)
  end
 
  def test_query
    assert(PubMed.query('chagoyen[All Fields] AND ("loattrfull text"[sb] AND hasabstract[text])').include? '16438716')
  end

  def test_year
    pmid = '16438716'
    assert_equal "2006", PubMed.get_article(pmid).year
  end

  def test_bibentry
    assert("vazquez2008sent", PubMed::Article.make_bibentry('vazquez', 2008, "SENT: Semantic features in text"))
    assert("vazquez2008aes", PubMed::Article.make_bibentry('vazquez', 2008, "An Example System"))
  end
end


Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rbbt-sources-3.0.0 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.7 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.5 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.4 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.3 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.2 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.1 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.1.0 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.0.2 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.0.1 test/rbbt/sources/test_pubmed.rb
rbbt-sources-2.0.0 test/rbbt/sources/test_pubmed.rb