Skip to content

Commit 3ec028b

Browse files
committed
brief refactor in detector checking
1 parent e49e49f commit 3ec028b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/detectors/test_detectors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ def test_detector_structure(classname):
3636
m = importlib.import_module("garak." + ".".join(classname.split(".")[:-1]))
3737
d = getattr(m, classname.split(".")[-1])
3838

39+
detect_signature = inspect.signature(d.detect)
40+
3941
# has method detect
4042
assert "detect" in dir(d), f"detector {classname} must have a method detect"
4143
# _call_model has a generations_this_call param
4244
assert (
43-
"attempt" in inspect.signature(d.detect).parameters
45+
"attempt" in detect_signature.parameters
4446
), f"{classname}.detect() must accept parameter attempt"
4547
# any parameter that has a default must be supported
4648
unsupported_defaults = []

0 commit comments

Comments
 (0)