Skip to content

Commit c23be08

Browse files
committed
Use mocks from imcf-fiji-mocks
1 parent 27ad201 commit c23be08

1 file changed

Lines changed: 2 additions & 82 deletions

File tree

tests/test_misc.py

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import logging
44

5+
from org.scijava.script import ScriptInfo, ScriptModule
6+
57
import imcflibs.imagej.misc
68

79
from imcflibs.imagej.misc import bytes_to_human_readable
@@ -11,88 +13,6 @@
1113
PASSWORD_ITEMS = ["OMERO_PASSWD"]
1214

1315

14-
class ModuleItem:
15-
"""Mock for the org.scijava.module.ModuleItem interface."""
16-
17-
def __init__(self, input_name):
18-
"""ModuleItem constructor.
19-
20-
Parameters
21-
----------
22-
input_name : str
23-
FIXME: describe (see the ScriptModule class)
24-
"""
25-
self.input_name = input_name
26-
27-
def getName(self):
28-
"""Getter method for the "input_name" attribute.
29-
30-
Returns
31-
-------
32-
str
33-
"""
34-
return self.input_name
35-
36-
37-
class ScriptInfo:
38-
"""Mock for the org.scijava.script.ScriptInfo class."""
39-
40-
def __init__(self, input_names):
41-
"""ScriptInfo constructor.
42-
43-
Parameters
44-
----------
45-
input_names : list(str)
46-
FIXME: describe (see the ScriptModule class)
47-
"""
48-
self.input_names = [ModuleItem(x) for x in input_names]
49-
50-
def inputs(self):
51-
"""Get the list of input-objects.
52-
53-
Returns
54-
-------
55-
list(ModuleItem)
56-
"""
57-
return self.input_names
58-
59-
60-
class ScriptModule:
61-
"""Mock for the org.scijava.script.ScriptModule class."""
62-
63-
def __init__(self, input_names, inputs):
64-
"""ScriptModule constructor.
65-
66-
Parameters
67-
----------
68-
input_names : list(str)
69-
The list of input names. FIXME: explain better.
70-
inputs : dict
71-
A dict having the `input_names` as keys. Values are representing the
72-
content of the respective script parameter.
73-
"""
74-
self.info = ScriptInfo(input_names)
75-
self.inputs = inputs
76-
77-
def getInfo(self):
78-
"""Getter method for the "info" attribute.
79-
80-
Returns
81-
-------
82-
ScriptInfo
83-
"""
84-
return self.info
85-
86-
def getInputs(self):
87-
"""Getter method for the "inputs" attribute.
88-
89-
Returns
90-
-------
91-
dict
92-
"""
93-
return self.inputs
94-
95-
9616
def test_save_script_parameters_fail(caplog):
9717
"""Tests save_script_parameters with an invalid script_globals object."""
9818
caplog.clear()

0 commit comments

Comments
 (0)