@@ -479,25 +479,42 @@ class TestDeprecatedAliases:
479479 """Tests for backward-compatible ContentHarms aliases."""
480480
481481 def test_content_harms_is_rapid_response (self ):
482- from pyrit .scenario .scenarios .airt .content_harms import ContentHarms
482+ with pytest .warns (DeprecationWarning , match = "ContentHarms" ):
483+ from pyrit .scenario .scenarios .airt .content_harms import ContentHarms
483484
484485 assert ContentHarms is RapidResponse
485486
486487 def test_content_harms_strategy_is_rapid_response_strategy (self ):
487- from pyrit .scenario .scenarios .airt .content_harms import ContentHarmsStrategy
488+ with pytest .warns (DeprecationWarning , match = "ContentHarmsStrategy" ):
489+ from pyrit .scenario .scenarios .airt .content_harms import ContentHarmsStrategy
488490
489491 assert ContentHarmsStrategy is _strategy_class ()
490492
491493 def test_content_harms_instance_name_is_rapid_response (self , mock_objective_scorer ):
492494 """ContentHarms() creates a RapidResponse with name 'RapidResponse'."""
493- from pyrit .scenario .scenarios .airt .content_harms import ContentHarms
495+ with pytest .warns (DeprecationWarning , match = "ContentHarms" ):
496+ from pyrit .scenario .scenarios .airt .content_harms import ContentHarms
494497
495498 scenario = ContentHarms (
496499 objective_scorer = mock_objective_scorer ,
497500 )
498501 assert scenario .name == "RapidResponse"
499502 assert isinstance (scenario , RapidResponse )
500503
504+ def test_content_harms_via_airt_package_emits_deprecation_warning (self ):
505+ """Importing ``ContentHarms`` from the parent ``airt`` package emits the warning."""
506+ with pytest .warns (DeprecationWarning , match = "ContentHarms" ):
507+ from pyrit .scenario .scenarios .airt import ContentHarms
508+
509+ assert ContentHarms is RapidResponse
510+
511+ def test_content_harms_strategy_via_airt_package_emits_deprecation_warning (self ):
512+ """Importing ``ContentHarmsStrategy`` from the parent ``airt`` package emits the warning."""
513+ with pytest .warns (DeprecationWarning , match = "ContentHarmsStrategy" ):
514+ from pyrit .scenario .scenarios .airt import ContentHarmsStrategy
515+
516+ assert ContentHarmsStrategy is _strategy_class ()
517+
501518
502519# ===========================================================================
503520# Registry integration tests
0 commit comments