diff options
author | helma@in-silico.ch <helma@in-silico.ch> | 2018-11-12 17:08:51 +0100 |
---|---|---|
committer | helma@in-silico.ch <helma@in-silico.ch> | 2018-11-12 17:08:51 +0100 |
commit | 6d68a1ca94937a0553f61ebbbbd317dae54ce4e6 (patch) | |
tree | 02df42992b8ec3bcd8230826b8ccde5820c35359 /test/download.rb | |
parent | cf80ed17102a0368df8d65037d113b521cdf6f0c (diff) |
PubChem classification download
Diffstat (limited to 'test/download.rb')
-rw-r--r-- | test/download.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/download.rb b/test/download.rb new file mode 100644 index 0000000..9fd0f40 --- /dev/null +++ b/test/download.rb @@ -0,0 +1,22 @@ +require_relative "setup.rb" + +class DownloadTest < MiniTest::Test + + def test_pubchem_classification + Download.pubchem_classification aid: 1191, active: "carcinogen", inactive: "non-carcinogen", species: "Hamster", endpoint: "Carcinogen" + csv = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.csv") + meta_file = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.json") + assert File.exists?(csv) + table = CSV.read csv + assert_equal 87, table.size + assert_equal ["48413129", "CC=O", "carcinogen"], table[1] + meta = JSON.parse(File.read(meta_file)) + assert_equal "Hamster", meta["species"] + assert_equal 1, meta["warnings"].size + FileUtils.rm(csv) + FileUtils.rm(meta_file) + end + +end + + |