Skip to content

Commit

Permalink
add test for sleepless decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Nov 13, 2023
1 parent bac2dc4 commit c19a9c7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ibllib/tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ibllib.io.extractors.base
import ibllib.tests.fixtures.utils as fu
from ibllib.pipes import misc
from ibllib.pipes.misc import sleepless
from ibllib.tests import TEST_DB
import ibllib.pipes.scan_fix_passive_files as fix
from ibllib.pipes.base_tasks import RegisterRawDataTask
Expand Down Expand Up @@ -698,5 +699,23 @@ def test_rename_files(self):
self.assertCountEqual(expected, files)


class TestSleeplessDecorator(unittest.TestCase):

def test_decorator_argument_passing(self):

def dummy_function(arg1, arg2):
return arg1, arg2

# Applying the decorator to the dummy function
decorated_func = sleepless(dummy_function)

# Check if the function name is maintained
self.assertEqual(decorated_func.__name__, 'dummy_function')

# Check if arguments are passed correctly
result = decorated_func("test1", "test2")
self.assertEqual(result, ("test1", "test2"))


if __name__ == '__main__':
unittest.main(exit=False, verbosity=2)

0 comments on commit c19a9c7

Please sign in to comment.