@@ -46,15 +46,7 @@ def _name(self) -> str:
4646 return self .template_name
4747
4848 def _load_dataset_attributes (self ) -> None :
49- return None # Mock implementation
50-
51- def create_dataset (self ) -> str :
52- """Create a mock dataset.
53-
54- Returns:
55- str: A message indicating the dataset creation.
56- """
57- return f"Mock dataset created by { self .template_name } "
49+ return None # pragma: no cover - Mock implementation
5850
5951
6052def _assert_default_templates (template_names : list [str ]) -> None :
@@ -92,12 +84,9 @@ def test_singleton_thread_safety(self) -> None:
9284 errors = []
9385
9486 def create_instance () -> None :
95- try :
96- instance = TemplateRegistry ()
97- instances .append (instance )
98- time .sleep (0.001 ) # Small delay to increase contention
99- except Exception as e :
100- errors .append (e )
87+ instance = TemplateRegistry ()
88+ instances .append (instance )
89+ time .sleep (0.001 ) # Small delay to increase contention
10190
10291 # Create multiple threads trying to create instances
10392 threads = [threading .Thread (target = create_instance ) for _ in range (10 )]
@@ -311,13 +300,10 @@ def test_concurrent_registration(self) -> None:
311300 errors = []
312301
313302 def register_template_worker (template_id : int ) -> None :
314- try :
315- template = MockDatasetTemplate (f"template_{ template_id } " )
316- name = registry .register (template )
317- results .append ((template_id , name ))
318- time .sleep (0.001 ) # Small delay
319- except Exception as e :
320- errors .append ((template_id , e ))
303+ template = MockDatasetTemplate (f"template_{ template_id } " )
304+ name = registry .register (template )
305+ results .append ((template_id , name ))
306+ time .sleep (0.001 ) # Small delay
321307
322308 # Create multiple threads registering different templates
323309 threads = [threading .Thread (target = register_template_worker , args = (i ,)) for i in range (10 )]
@@ -351,28 +337,24 @@ def test_concurrent_access_mixed_operations(self) -> None:
351337 errors = []
352338
353339 def mixed_operations_worker (worker_id : int ) -> None :
354- try :
355- operations_results = []
356-
357- # Get existing template
358- if worker_id % 2 == 0 :
359- template = registry .get ("initial_0" )
360- operations_results .append (("get" , template .template_name ))
340+ operations_results = []
361341
362- # Register new template
363- if worker_id % 3 == 0 :
364- new_template = MockDatasetTemplate (f"worker_{ worker_id } " )
365- name = registry .register (new_template )
366- operations_results .append (("register" , name ))
342+ # Get existing template
343+ if worker_id % 2 == 0 :
344+ template = registry .get ("initial_0" )
345+ operations_results .append (("get" , template .template_name ))
367346
368- # List templates
369- templates = registry .list_all_templates ()
370- operations_results .append (("list" , len (templates )))
347+ # Register new template
348+ if worker_id % 3 == 0 :
349+ new_template = MockDatasetTemplate (f"worker_{ worker_id } " )
350+ name = registry .register (new_template )
351+ operations_results .append (("register" , name ))
371352
372- results .append ((worker_id , operations_results ))
353+ # List templates
354+ templates = registry .list_all_templates ()
355+ operations_results .append (("list" , len (templates )))
373356
374- except Exception as e :
375- errors .append ((worker_id , e ))
357+ results .append ((worker_id , operations_results ))
376358
377359 # Run concurrent operations
378360 threads = [threading .Thread (target = mixed_operations_worker , args = (i ,)) for i in range (15 )]
0 commit comments