diff options
author | Christoph Helma <helma@in-silico.ch> | 2019-08-24 15:06:53 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2019-08-24 15:06:53 +0200 |
commit | 8e1e8b94539dbdd74bd4ac28295cbfd1b84036ab (patch) | |
tree | 28528e19dc6ed4cca7ed824e939dedd6c4acc94c /test/download.rb | |
parent | 1ee7de09c969e16fd11522d22179224e694b0161 (diff) | |
parent | 488ce9fe6d4b715680675861105b8c52a7535140 (diff) |
Merge remote-tracking branch 'origin/development'
Diffstat (limited to 'test/download.rb')
-rw-r--r-- | test/download.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/download.rb b/test/download.rb new file mode 100644 index 0000000..aeb99b9 --- /dev/null +++ b/test/download.rb @@ -0,0 +1,30 @@ +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 + + def test_import_daphnia + Download.daphnia + table = CSV.read File.join(Download::DATA,"Acute_toxicity-Daphnia_magna.csv") + assert_equal "BrC(Br)Br", table[1][1] + assert_equal 0.74, table[1][2].to_f.round(2) + assert_equal "-log[LC50_mmol/L]", table[0][2] + end + +end + + |