summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-12-20 19:08:26 +0100
committerChristoph Helma <helma@in-silico.de>2009-12-20 19:08:26 +0100
commitf8e10fe226e408743b57de2d4d8f9ba02eb8bae9 (patch)
treebb708d52654c28fdec67b85f101040cb4d012e65
parentb3141574e290ab4406bfa057cf10d506411cbb47 (diff)
Test for prediction result added
-rw-r--r--features/lazar_single_prediction.feature (renamed from features/lazar.feature)0
-rw-r--r--features/step_definitions/lazar_steps.rb16
2 files changed, 13 insertions, 3 deletions
diff --git a/features/lazar.feature b/features/lazar_single_prediction.feature
index d72bea6..d72bea6 100644
--- a/features/lazar.feature
+++ b/features/lazar_single_prediction.feature
diff --git a/features/step_definitions/lazar_steps.rb b/features/step_definitions/lazar_steps.rb
index a60fdfb..9ba5842 100644
--- a/features/step_definitions/lazar_steps.rb
+++ b/features/step_definitions/lazar_steps.rb
@@ -9,8 +9,18 @@ Then /^the model should predict (.*) for (.*)$/ do |activity,smiles|
compound_uri = OpenTox::Compound.new(:smiles => smiles).uri
#puts @uri
#puts compound_uri
- prediction = RestClient.post @uri, :compound_uri => compound_uri, :type => "yaml"
- puts prediction
- #assert_equal activity.to_s, YAML.load(prediction)[:values]['classification'].to_s
+ prediction = RestClient.post @uri, :compound_uri => compound_uri, :accept => "application/x-yaml"
+ model = Redland::Model.new Redland::MemoryStore.new
+ parser = Redland::Parser.new
+ parser.parse_string_into_model(model,prediction,'/')
+
+ #puts prediction
+ model.subjects(RDF['type'], OT['FeatureValue']).each do |v|
+ feature = model.object(v,OT['feature'])
+ feature_name = model.object(feature,DC['title']).to_s
+ prediction = model.object(v,OT['value']).to_s if feature_name.match(/classification/)
+ end
+ #puts values.to_yaml
+ assert_equal activity.to_s, prediction
end