Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
Signed-off-by: neuronflow <[email protected]>
  • Loading branch information
neuronflow committed Apr 16, 2024
1 parent b13906b commit 48ae7f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
15 changes: 6 additions & 9 deletions tests/registrator_base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
import shutil
import unittest
from abc import ABC, abstractmethod
from abc import abstractmethod

from auxiliary.turbopath import turbopath
import shutil


class RegistratorBase(unittest.TestCase):
class RegistratorBase:

@abstractmethod
def get_registrator(self):
Expand All @@ -29,14 +28,12 @@ def setUp(self):
self.moving_image = input_dir + "/tcia_example_t1.nii.gz"

self.matrix = self.output_dir + f"/{self.method_name}_matrix"
self.transform_matrix = (
input_dir + f"/{self.method_name}_matrix.{self.matrix_extension}"
)
self.transform_matrix = input_dir + f"/{self.method_name}_matrix"

def tearDown(self):
# Clean up created files if they exist
# shutil.rmtree(self.output_dir)
pass
shutil.rmtree(self.output_dir)
# pass

def test_register_creates_output_files(self):
transformed_image = (
Expand Down
8 changes: 5 additions & 3 deletions tests/test_registrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@
from brainles_preprocessing.registration.eReg.eReg import eRegRegistrator
from brainles_preprocessing.registration.niftyreg.niftyreg import NiftyRegRegistrator

import unittest

class TestANTsRegistrator(RegistratorBase):

class TestANTsRegistrator(RegistratorBase, unittest.TestCase):
def get_registrator(self):
return ANTsRegistrator()

def get_method_and_extension(self):
return "ants", "mat"


class TestNiftyRegRegistratorRegistrator(RegistratorBase):
class TestNiftyRegRegistratorRegistrator(RegistratorBase, unittest.TestCase):
def get_registrator(self):
return NiftyRegRegistrator()

def get_method_and_extension(self):
return "niftyreg", "txt"


class TestEregRegistratorRegistrator(RegistratorBase):
class TestEregRegistratorRegistrator(RegistratorBase, unittest.TestCase):
def get_registrator(self):
return eRegRegistrator()

Expand Down

0 comments on commit 48ae7f8

Please sign in to comment.