@@ -440,58 +440,70 @@ def check_pair(cif_set):
440440# ============================================================================
441441
442442
443- def test_count_intra_consistency_SG (_benchmark_data ):
444- """Test that Substitutor.count() matches the actual number of generated structures ."""
443+ def test_count_inter_consistency_SG (_benchmark_data ):
444+ """Test that Substitutor.count() matches SG benchmark equivalent-structure counts ."""
445445 for test_case in _benchmark_data :
446446 cif_file = test_case ["cif_file" ]
447447 supercell_array = test_case ["supercell_array" ]
448+ expected_count = test_case ["expected_count" ]
448449
449- # Skip if file doesn't exist
450450 if not os .path .exists (cif_file ):
451451 pytest .skip (f"File not found: { cif_file } " )
452452
453- # Create Substitutor
453+ if expected_count is None :
454+ pytest .skip (f"No benchmark count available for: { cif_file } " )
455+
454456 s , structure , error = _create_substitutor (cif_file , supercell_array )
455457 if error :
456458 pytest .skip (f"{ error ['status' ]} : { error ['error' ]} " )
457459
458- # Get expected count
459- count_expected = s .count ()
460+ count_obtained = s .count ()
461+ assert count_obtained == expected_count , (
462+ f"Benchmark mismatch for { test_case ['file_basename' ]} : "
463+ f"Substitutor.count()={ count_obtained } , benchmark={ expected_count } "
464+ )
460465
461- # Generate all structures
462- configs = _generate_all_structures (s )
463- if configs is None :
464- pytest .fail ("Failed to generate structures" )
465466
466- count_actual = len (configs )
467+ @pytest .mark .skip (reason = "Not implemented yet" )
468+ def test_count_inter_consistency_MSG ():
469+ """Test that Substitutor.count() matches MSG benchmark equivalent-structure counts."""
470+ pass
467471
468- # Check consistency
469- assert count_expected == count_actual , (
470- f"Count mismatch: Substitutor.count()={ count_expected } , but generated { count_actual } "
471- )
472472
473+ def test_count_intra_consistency_SG (_benchmark_data , pytestconfig ):
474+ """Test that Substitutor.count() matches the actual number of generated structures."""
475+ option_value = pytestconfig .getoption ("--SG-redundancy" )
476+ if str (option_value ).strip ().lower () in {"" , "0" , "off" , "false" , "none" }:
477+ pytest .skip ("--SG-redundancy is disabled (set --SG-redundancy=N or all)" )
473478
474- def test_count_inter_consistency_SG (_benchmark_data ):
475- """Test that Substitutor.count() matches SG benchmark equivalent-structure counts."""
476- for test_case in _benchmark_data :
479+ selected_cases = _select_redundancy_cases (_benchmark_data , option_value , "--SG-redundancy" )
480+
481+ for test_case in selected_cases :
477482 cif_file = test_case ["cif_file" ]
478483 supercell_array = test_case ["supercell_array" ]
479- expected_count = test_case ["expected_count" ]
480484
485+ # Skip if file doesn't exist
481486 if not os .path .exists (cif_file ):
482487 pytest .skip (f"File not found: { cif_file } " )
483488
484- if expected_count is None :
485- pytest .skip (f"No benchmark count available for: { cif_file } " )
486-
489+ # Create Substitutor
487490 s , structure , error = _create_substitutor (cif_file , supercell_array )
488491 if error :
489492 pytest .skip (f"{ error ['status' ]} : { error ['error' ]} " )
490493
491- count_obtained = s .count ()
492- assert count_obtained == expected_count , (
493- f"Benchmark mismatch for { test_case ['file_basename' ]} : "
494- f"Substitutor.count()={ count_obtained } , benchmark={ expected_count } "
494+ # Get expected count
495+ count_expected = s .count ()
496+
497+ # Generate all structures
498+ configs = _generate_all_structures (s )
499+ if configs is None :
500+ pytest .fail ("Failed to generate structures" )
501+
502+ count_actual = len (configs )
503+
504+ # Check consistency
505+ assert count_expected == count_actual , (
506+ f"Count mismatch: Substitutor.count()={ count_expected } , but generated { count_actual } "
495507 )
496508
497509
@@ -526,6 +538,34 @@ def test_no_redundancy_SG(pytestconfig):
526538 _run_redundancy_check (configs , structure , msg_mode = False )
527539
528540
541+ def test_count_intra_consistency_MSG (magnetic_benchmark_data , pytestconfig ):
542+ """Test that MSG Substitutor.count() matches the number of generated structures."""
543+ option_value = pytestconfig .getoption ("--MSG-redundancy" )
544+ selected_cases = _select_redundancy_cases (magnetic_benchmark_data , option_value , "--MSG-redundancy" )
545+
546+ for magnetic_test_case in selected_cases :
547+ cif_file = magnetic_test_case ["cif_file" ]
548+
549+ if not os .path .exists (cif_file ):
550+ pytest .skip (f"File not found: { cif_file } " )
551+
552+ s , structure , error = _create_substitutor (cif_file , supercell_array = None )
553+ if error :
554+ pytest .skip (f"{ error ['status' ]} : { error ['error' ]} " )
555+
556+ count_expected = s .count ()
557+
558+ configs = _generate_all_structures (s )
559+ if configs is None :
560+ pytest .fail ("Failed to generate structures" )
561+
562+ count_actual = len (configs )
563+ assert count_expected == count_actual , (
564+ f"MSG count mismatch for { magnetic_test_case ['file_basename' ]} : "
565+ f"Substitutor.count()={ count_expected } , but generated { count_actual } "
566+ )
567+
568+
529569def test_no_redundancy_MSG (magnetic_benchmark_data , pytestconfig ):
530570 """Test that generated MSG structures are symmetrically inequivalent (no redundancy)."""
531571 option_value = pytestconfig .getoption ("--MSG-redundancy" )
0 commit comments