Skip to content

Commit

Permalink
Make banner line test dynamic (NVIDIA#670)
Browse files Browse the repository at this point in the history
Build the banner string check in a dynamic pattern

Signed-off-by: Jeffrey Martin <[email protected]>
  • Loading branch information
jmartin-tech authored May 10, 2024
1 parent a85b8d2 commit 8152472
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import os

from garak import __version__, cli, _config
from garak import __app__, __description__, __version__, cli, _config

ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")

Expand All @@ -23,7 +23,7 @@ def test_probe_list(capsys):
for line in output.strip().split("\n"):
assert re.match(
r"^probes: [a-z0-9_]+(\.[A-Za-z0-9_]+)?( 🌟)?( πŸ’€)?$", line
) or line.startswith("garak LLM security probe v")
) or line.startswith(f"{__app__} {__description__}")


def test_detector_list(capsys):
Expand All @@ -33,7 +33,7 @@ def test_detector_list(capsys):
for line in output.strip().split("\n"):
assert re.match(
r"^detectors: [a-z0-9_]+(\.[A-Za-z0-9_]+)?( 🌟)?( πŸ’€)?$", line
) or line.startswith("garak LLM security probe v")
) or line.startswith(f"{__app__} {__description__}")


def test_generator_list(capsys):
Expand All @@ -43,7 +43,7 @@ def test_generator_list(capsys):
for line in output.strip().split("\n"):
assert re.match(
r"^generators: [a-z0-9_]+(\.[A-Za-z0-9_]+)?( 🌟)?( πŸ’€)?$", line
) or line.startswith("garak LLM security probe v")
) or line.startswith(f"{__app__} {__description__}")


def test_buff_list(capsys):
Expand All @@ -53,7 +53,7 @@ def test_buff_list(capsys):
for line in output.strip().split("\n"):
assert re.match(
r"^buffs: [a-z0-9_]+(\.[A-Za-z0-9_]+)?( 🌟)?( πŸ’€)?$", line
) or line.startswith("garak LLM security probe v")
) or line.startswith(f"{__app__} {__description__}")


def test_run_all_active_probes(capsys):
Expand Down

0 comments on commit 8152472

Please sign in to comment.