@@ -433,7 +433,7 @@ def test_transform_author_identifiers(running_app):
433433
434434
435435def test_transform_author_affiliations (running_app ):
436- """Test CreatibutorsMapper._transform_author_affiliations."""
436+ """Test CreatibutorsMapper._transform_author_affiliations without ROR identifiers ."""
437437 author = {
438438 "affiliations" : [
439439 {"value" : "CERN" },
@@ -450,6 +450,52 @@ def test_transform_author_affiliations(running_app):
450450 assert {"name" : "MIT" } in result
451451
452452
453+ def test_transform_author_affiliations_with_ror (running_app ):
454+ """Test CreatibutorsMapper._transform_author_affiliations with ROR identifiers."""
455+ author = {
456+ "affiliations" : [
457+ {"value" : "IJCLab, Orsay" },
458+ {"value" : "CERN" },
459+ ],
460+ "affiliations_identifiers" : [
461+ {"value" : "grid.460789.4" , "schema" : "GRID" },
462+ {"value" : "grid.9132.9" , "schema" : "GRID" },
463+ {"value" : "https://ror.org/03gc1p724" , "schema" : "ROR" },
464+ {"value" : "https://ror.org/01ggx4157" , "schema" : "ROR" },
465+ ],
466+ }
467+
468+ mapper = CreatibutorsMapper ()
469+ result = mapper ._transform_author_affiliations (author )
470+
471+ assert len (result ) == 2
472+ assert {"id" : "03gc1p724" } in result
473+ assert {"id" : "01ggx4157" } in result
474+
475+
476+ def test_transform_author_affiliations_with_ror_partial (running_app ):
477+ """Test fallback to name when ROR count is less than affiliations count."""
478+ author = {
479+ "affiliations" : [
480+ {"value" : "IJCLab, Orsay" },
481+ {"value" : "CERN" },
482+ {"value" : "Unknown Institute" },
483+ ],
484+ "affiliations_identifiers" : [
485+ {"value" : "https://ror.org/03gc1p724" , "schema" : "ROR" },
486+ {"value" : "https://ror.org/01ggx4157" , "schema" : "ROR" },
487+ ],
488+ }
489+
490+ mapper = CreatibutorsMapper ()
491+ result = mapper ._transform_author_affiliations (author )
492+
493+ assert len (result ) == 3
494+ assert {"id" : "03gc1p724" } in result
495+ assert {"id" : "01ggx4157" } in result
496+ assert {"name" : "Unknown Institute" } in result
497+
498+
453499def test_transform_copyrights_complete (running_app ):
454500 """Test CopyrightMapper with complete copyright info."""
455501 src_metadata = {
0 commit comments