diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2009-12-14 15:12:37 +0100 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2009-12-14 15:12:37 +0100 |
commit | f5a6f160afd864848c3b3a11a0f643b395159763 (patch) | |
tree | 74ca62c51f62116a19f567a98d2b88476e54b220 /lib/test_util.rb | |
parent | c647dd756a74bbd2ad61b2e8158d6afe7a175965 (diff) |
added support for non-binary classification
Diffstat (limited to 'lib/test_util.rb')
-rw-r--r-- | lib/test_util.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/test_util.rb b/lib/test_util.rb index 2916b55..54df08b 100644 --- a/lib/test_util.rb +++ b/lib/test_util.rb @@ -7,11 +7,17 @@ module Lib # updloads a dataset def upload_data(ws, name, file) - data_uri = RestClient.post ws, :name => name - puts "created dataset "+data_uri.to_s + begin + data_uri = RestClient.post ws, :name => name + puts "created dataset "+data_uri.to_s + assert data_uri==ext("curl -X PUT -F 'file=@"+file.path+";type=text/csv' -F compound_format=smiles "+data_uri+"/import",nil) + rescue RestClient::RequestFailed => ex + raise "could not upload dataset "+ex.message unless ex.message =~ /.*403.*/ + data_uri = File.join(ws,name) + puts "already uploaded "+data_uri.to_s + end + add_resource(data_uri) - - assert data_uri==ext("curl -X PUT -F 'file=@"+file.path+";type=text/csv' -F compound_format=smiles "+data_uri+"/import",nil) return data_uri end @@ -38,12 +44,12 @@ module Lib # execute an external program like curl def ext(call, indent=" ") response = "" - IO.popen(call.to_s+" 2> /dev/null") do |f| + IO.popen(call.to_s+" 2> /dev/null") do |f| while line = f.gets response += indent.to_s+line end end - assert $?==0 + assert $?==0, "returns error "+call+" "+response return response end |