File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -235,12 +235,15 @@ def test_initialize_model_with_valid_path(monkeypatch):
235235 """
236236 Test initialize_model with a valid classifier path.
237237 """
238+ from pathlib import Path
239+
238240 import nemoguardrails .library .jailbreak_detection .model_based .checks as checks
239241
240242 checks .initialize_model .cache_clear ()
241243
242244 # mock environment variable
243- monkeypatch .setenv ("EMBEDDING_CLASSIFIER_PATH" , "/fake/path/to/model" )
245+ test_path = "/fake/path/to/model"
246+ monkeypatch .setenv ("EMBEDDING_CLASSIFIER_PATH" , test_path )
244247
245248 # mock JailbreakClassifier
246249 mock_classifier = mock .MagicMock ()
@@ -253,9 +256,9 @@ def test_initialize_model_with_valid_path(monkeypatch):
253256 result = checks .initialize_model ()
254257
255258 assert result == mock_classifier
256- mock_jailbreak_classifier_class . assert_called_once_with (
257- "/fake/path/to/model/ snowflake.pkl"
258- )
259+
260+ expected_path = str ( Path ( test_path ). joinpath ( " snowflake.pkl"))
261+ mock_jailbreak_classifier_class . assert_called_once_with ( expected_path )
259262
260263
261264# Test 10: Test that NvEmbedE5 class no longer exists
You can’t perform that action at this time.
0 commit comments