From 9f9b8f1d694b6a20e0bcad58a3b1260dc5959f13 Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 15:30:00 -0800 Subject: [PATCH] fixed failing unit tests as a result of modifying the test ontologies --- Gemfile.lock | 2 +- test/controllers/test_classes_controller.rb | 67 +++++++++++---------- test/controllers/test_metrics_controller.rb | 28 ++++----- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ebd691ab..26e296d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: cbada0066156727195b350ca365de480e5fdde7a + revision: 0598b9f6e8a37a42938f1db8648ff1b3355be519 branch: multilingual_preflabels specs: ontologies_linked_data (0.0.1) diff --git a/test/controllers/test_classes_controller.rb b/test/controllers/test_classes_controller.rb index 9e1f9609..1811062d 100644 --- a/test/controllers/test_classes_controller.rb +++ b/test/controllers/test_classes_controller.rb @@ -295,42 +295,43 @@ def test_descendants_for_cls descendants_data = {} descendants_data['http://bioontology.org/ontologies/ResearchArea.owl#Area_of_Research'] =[ "http://bioontology.org/ontologies/ResearchArea.owl#Behavioral_Science", - "http://bioontology.org/ontologies/ResearchArea.owl#Bioinformatics", - "http://bioontology.org/ontologies/ResearchArea.owl#Biostatistics", - "http://bioontology.org/ontologies/ResearchArea.owl#Clinical_Studies", - "http://bioontology.org/ontologies/ResearchArea.owl#Computational_Biology", - "http://bioontology.org/ontologies/ResearchArea.owl#Epidemiology", - "http://bioontology.org/ontologies/ResearchArea.owl#Genomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Metabolomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Nursing", - "http://bioontology.org/ontologies/ResearchArea.owl#Outcomes_Research", - "http://bioontology.org/ontologies/ResearchArea.owl#Pathology", - "http://bioontology.org/ontologies/ResearchArea.owl#Pediatrics", - "http://bioontology.org/ontologies/ResearchArea.owl#Pharmacokinetics_Pharmacodynamics", - "http://bioontology.org/ontologies/ResearchArea.owl#Physiology", - "http://bioontology.org/ontologies/ResearchArea.owl#Preclinical", - "http://bioontology.org/ontologies/ResearchArea.owl#Proteomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Psychometrics", - "http://bioontology.org/ontologies/ResearchArea.owl#Research_IT", - "http://bioontology.org/ontologies/ResearchArea.owl#Toxicology"] + "http://bioontology.org/ontologies/ResearchArea.owl#Bioinformatics", + "http://bioontology.org/ontologies/ResearchArea.owl#Biostatistics", + "http://bioontology.org/ontologies/ResearchArea.owl#Clinical_Studies", + "http://bioontology.org/ontologies/ResearchArea.owl#Computational_Biology", + "http://bioontology.org/ontologies/ResearchArea.owl#Epidemiology", + "http://bioontology.org/ontologies/ResearchArea.owl#Genomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Metabolomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Nursing", + "http://bioontology.org/ontologies/ResearchArea.owl#Outcomes_Research", + "http://bioontology.org/ontologies/ResearchArea.owl#Pathology", + "http://bioontology.org/ontologies/ResearchArea.owl#Pediatrics", + "http://bioontology.org/ontologies/ResearchArea.owl#Pharmacokinetics_Pharmacodynamics", + "http://bioontology.org/ontologies/ResearchArea.owl#Physiology", + "http://bioontology.org/ontologies/ResearchArea.owl#Preclinical", + "http://bioontology.org/ontologies/ResearchArea.owl#Proteomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Psychometrics", + "http://bioontology.org/ontologies/ResearchArea.owl#Research_IT", + "http://bioontology.org/ontologies/ResearchArea.owl#Toxicology"] descendants_data['http://bioontology.org/ontologies/Activity.owl#Activity'] = ["http://bioontology.org/ontologies/Activity.owl#Biospecimen_Management", - "http://bioontology.org/ontologies/Activity.owl#Community_Engagement", - "http://bioontology.org/ontologies/Activity.owl#Gene_Therapy", - "http://bioontology.org/ontologies/Activity.owl#Health_Services", - "http://bioontology.org/ontologies/Activity.owl#IRB", - "http://bioontology.org/ontologies/Activity.owl#Medical_Device_Development", - "http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance", - "http://bioontology.org/ontologies/Activity.owl#Research_Funding", - "http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management", - "http://bioontology.org/ontologies/Activity.owl#Resource_Inventory", - "http://bioontology.org/ontologies/Activity.owl#Small_Molecule", - "http://bioontology.org/ontologies/Activity.owl#Social_Networking", - "http://bioontology.org/ontologies/Activity.owl#Software_Development", - "http://bioontology.org/ontologies/Activity.owl#Surgical_Procedure", - "http://bioontology.org/ontologies/Activity.owl#Therapeutics", - "http://bioontology.org/ontologies/Activity.owl#Training"] + "http://bioontology.org/ontologies/Activity.owl#Catalog", + "http://bioontology.org/ontologies/Activity.owl#Community_Engagement", + "http://bioontology.org/ontologies/Activity.owl#Gene_Therapy", + "http://bioontology.org/ontologies/Activity.owl#Health_Services", + "http://bioontology.org/ontologies/Activity.owl#IRB", + "http://bioontology.org/ontologies/Activity.owl#Medical_Device_Development", + "http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance", + "http://bioontology.org/ontologies/Activity.owl#Research_Funding", + "http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management", + "http://bioontology.org/ontologies/Activity.owl#Resource_Inventory", + "http://bioontology.org/ontologies/Activity.owl#Small_Molecule", + "http://bioontology.org/ontologies/Activity.owl#Social_Networking", + "http://bioontology.org/ontologies/Activity.owl#Software_Development", + "http://bioontology.org/ontologies/Activity.owl#Surgical_Procedure", + "http://bioontology.org/ontologies/Activity.owl#Therapeutics", + "http://bioontology.org/ontologies/Activity.owl#Training"] clss_ids = [ 'http://bioontology.org/ontologies/Activity.owl#Activity', "http://bioontology.org/ontologies/ResearchArea.owl#Area_of_Research" ] diff --git a/test/controllers/test_metrics_controller.rb b/test/controllers/test_metrics_controller.rb index 0d8b547d..eb06c3f8 100644 --- a/test/controllers/test_metrics_controller.rb +++ b/test/controllers/test_metrics_controller.rb @@ -9,15 +9,15 @@ def before_suite end OntologySubmission.all.each {|s| s.delete } Ontology.all.each {|o| o.delete } - @@data = {"classes"=>486, - "averageChildCount"=>5, - "maxChildCount"=>65, - "classesWithOneChild"=>14, - "classesWithMoreThan25Children"=>2, - "classesWithNoDefinition"=>11, - "individuals"=>124, - "properties"=>63, - "maxDepth"=> 7 } + @@data = {"classes" => 487, + "averageChildCount" => 5, + "maxChildCount" => 65, + "classesWithOneChild" => 14, + "classesWithMoreThan25Children" => 2, + "classesWithNoDefinition" => 11, + "individuals" => 124, + "properties" => 63, + "maxDepth" => 7 } @@options = { ont_count: 2, submission_count: 3, submissions_to_process: [1, 2], @@ -35,8 +35,8 @@ def test_all_metrics #TODO: improve this test and test for two different ontologies #though this is tested in LD metrics.each do |m| - @@data.each do |k,v| - assert_equal(m[k], v) + @@data.each do |k, v| + assert_equal(v, m[k]) end assert m["@id"] == m["submission"].first + "/metrics" end @@ -49,7 +49,7 @@ def test_single_metrics metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end @@ -59,7 +59,7 @@ def test_metrics_with_submission_id assert last_response.ok? metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end @@ -69,7 +69,7 @@ def test_metrics_with_submission_id_as_param assert last_response.ok? metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end