@@ -73,7 +73,9 @@ def test_load_job_configuration_identifier_with_spaces_error(
7373 with pytest .raises (LoadingJobsYAMLError ) as exc_info :
7474 load_job_configuration ([str (config_file )], None )
7575
76- assert "Job identifiers cannot contain spaces" in str (exc_info .value )
76+ assert "Job identifiers can only contain letters, digits, underscores, and hyphens" in str (
77+ exc_info .value
78+ )
7779 assert "job with spaces" in str (exc_info .value )
7880
7981 def test_load_job_configuration_multiple_identifiers_with_spaces_error (
@@ -86,7 +88,9 @@ def test_load_job_configuration_multiple_identifiers_with_spaces_error(
8688 with pytest .raises (LoadingJobsYAMLError ) as exc_info :
8789 load_job_configuration ([str (config_file )], None )
8890
89- assert "Job identifiers cannot contain spaces" in str (exc_info .value )
91+ assert "Job identifiers can only contain letters, digits, underscores, and hyphens" in str (
92+ exc_info .value
93+ )
9094 assert "job with spaces" in str (exc_info .value )
9195 assert "another invalid job" in str (exc_info .value )
9296
@@ -124,7 +128,9 @@ def test_validate_job_identifiers_with_spaces(self):
124128 with pytest .raises (LoadingJobsYAMLError ) as exc_info :
125129 _validate_job_identifiers (jobs )
126130
127- assert "Job identifiers cannot contain spaces" in str (exc_info .value )
131+ assert "Job identifiers can only contain letters, digits, underscores, and hyphens" in str (
132+ exc_info .value
133+ )
128134 assert "job with spaces" in str (exc_info .value )
129135 assert "another job" in str (exc_info .value )
130136
@@ -139,9 +145,26 @@ def test_validate_job_identifiers_mixed_valid_invalid(self):
139145 with pytest .raises (LoadingJobsYAMLError ) as exc_info :
140146 _validate_job_identifiers (jobs )
141147
142- assert "Job identifiers cannot contain spaces" in str (exc_info .value )
148+ assert "Job identifiers can only contain letters, digits, underscores, and hyphens" in str (
149+ exc_info .value
150+ )
143151 assert "job with spaces" in str (exc_info .value )
144152
153+ def test_validate_job_identifiers_with_special_chars (self ):
154+ """Test that identifiers with special characters (e.g. &, @, .) are rejected."""
155+ jobs = {
156+ "job&name" : {},
157+ "job@name" : {},
158+ }
159+
160+ with pytest .raises (LoadingJobsYAMLError ) as exc_info :
161+ _validate_job_identifiers (jobs )
162+
163+ assert "Job identifiers can only contain letters, digits, underscores, and hyphens" in str (
164+ exc_info .value
165+ )
166+ assert "job&name" in str (exc_info .value )
167+
145168 def test_validate_job_identifiers_empty_dict (self ):
146169 """Test that validation passes for empty jobs dictionary."""
147170 jobs = {}
0 commit comments