Skip to content

Commit

Permalink
🎨 Updated ALC dataset tests. (:construction: #71)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferzcam committed Nov 18, 2024
1 parent 71ff459 commit 2d06da0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mowl/datasets/alc/alc_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.setLevel(logging.INFO)

class ALCDataset():
"""This class provides data-related methods to work with
Expand Down Expand Up @@ -80,7 +80,7 @@ def object_property_to_id(self):
return self._dataset.object_property_to_id

def get_grouped_axioms(self):
res = {}
res = dict()
for axiom in self._ontology.getAxioms(Imports.INCLUDED):
axioms = [axiom, ]
if isinstance(axiom, OWLNaryAxiom):
Expand Down
3 changes: 2 additions & 1 deletion tests/datasets/test_alc_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ def test_get_grouped_axioms(self):
def test_get_datasets(self):
"""This should check grouped axiom patterns"""
alc_dataset = ALCDataset(self.ontology, self.dataset)
grouped_datasets = alc_dataset.get_datasets()
grouped_datasets, rest_of_axioms = alc_dataset.get_datasets()
self.assertIsInstance(grouped_datasets, dict)
self.assertIsInstance(rest_of_axioms, list)
for axiom, dataset in grouped_datasets.items():
self.assertIsInstance(axiom, OWLAxiom)
self.assertIsInstance(dataset, TensorDataset)
Expand Down
16 changes: 14 additions & 2 deletions tests/datasets/test_dataset_builtin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import mowl
from tests.datasetFactory import PPIYeastSlimDataset, GDAHumanELDataset, GDAMouseELDataset, \
FamilyDataset
from tests.datasetFactory import PPIYeastSlimDataset, GDAHumanELDataset, GDAMouseELDataset, FamilyDataset, GOSubsumptionDataset, FoodOnSubsumptionDataset
from unittest import TestCase
import os
import shutil
Expand Down Expand Up @@ -31,6 +30,17 @@ def test_gda_mouse_el_is_instance_of_dataset(self):
dataset = GDAMouseELDataset()
self.assertIsInstance(dataset, mowl.datasets.Dataset)

def test_go_subsumption_is_instance_of_dataset(self):
"""This should check if GOSubsumptionDataset is an instance of Dataset"""
dataset = GOSubsumptionDataset()
self.assertIsInstance(dataset, mowl.datasets.Dataset)

def test_foodon_subsumption_is_instance_of_dataset(self):
"""This should check if FoodOnSubsumptionDataset is an instance of Dataset"""
dataset = FoodOnSubsumptionDataset()
self.assertIsInstance(dataset, mowl.datasets.Dataset)


def test_evaluation_classes_ppi(self):
"""This should check the correct behaviour of evaluation_classes_method in ppi dataset"""
dataset = PPIYeastSlimDataset()
Expand Down Expand Up @@ -74,3 +84,5 @@ def test_evaluation_classes_gda_human(self):
rand_index = random.randint(0, len(str_classes_diseases) - 1)
self.assertIsInstance(str_classes_diseases[rand_index], str)
self.assertIsInstance(owl_classes_diseases[rand_index], OWLClass)


0 comments on commit 2d06da0

Please sign in to comment.