Sha256: c86adc334d5e61fdb481707d256859ac06e9e7263bab74d6ab1aaa78bf22d15e

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 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_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_pmc_full_xml
    pmid = '4304705'
    assert PubMed.get_article(pmid).pmc_full_xml.include?("HBV antigen")
  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

  def test_missing
    pmids = '18627426,014966295'.split(",")
    Log.severity = 0
    assert PubMed.get_article(pmids).include? "014966295"
    assert ! PubMed.get_article(pmids).include?("18627426")
  end

end


Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rbbt-sources-3.2.0 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.52 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.51 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.50 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.49 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.48 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.47 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.46 test/rbbt/sources/test_pubmed.rb
rbbt-sources-3.1.45 test/rbbt/sources/test_pubmed.rb