From a4760a8f5c818e1bf7fbcecd2addbdd5bb80230b Mon Sep 17 00:00:00 2001 From: Pablo Tamarit Date: Wed, 18 Dec 2024 10:23:50 +0100 Subject: [PATCH] serializers: bibtex: Conference proceeding to proceedings --- .../resources/serializers/bibtex/schema.py | 1 + .../serializers/test_bibtex_serializer.py | 29 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/invenio_rdm_records/resources/serializers/bibtex/schema.py b/invenio_rdm_records/resources/serializers/bibtex/schema.py index e80f2aa28..94e1f7bda 100644 --- a/invenio_rdm_records/resources/serializers/bibtex/schema.py +++ b/invenio_rdm_records/resources/serializers/bibtex/schema.py @@ -48,6 +48,7 @@ class BibTexSchema(BaseSerializerSchema, CommonFieldsMixin): BibTexFormatter.in_proceedings, BibTexFormatter.proceedings, ], + "publication-conferenceproceeding": [BibTexFormatter.proceedings], "publication-book": [ BibTexFormatter.book, BibTexFormatter.booklet, diff --git a/tests/resources/serializers/test_bibtex_serializer.py b/tests/resources/serializers/test_bibtex_serializer.py index 5d2d54610..45ed319ed 100644 --- a/tests/resources/serializers/test_bibtex_serializer.py +++ b/tests/resources/serializers/test_bibtex_serializer.py @@ -87,7 +87,6 @@ def test_bibtex_serializer_full_record(running_app, updated_full_record): ("publication"), ("publication-annotationcollection"), ("publication-section"), - ("publication-conferenceproceeding"), ("publication-datamanagementplan"), ("publication-journal"), ("publication-patent"), @@ -196,6 +195,34 @@ def test_serialize_publication_conferencepaper(running_app, updated_minimal_reco ) +def test_serialize_publication_conferenceproceeding( + running_app, updated_minimal_record +): + """Test bibtex formatter for conference proceedings. + + It serializes into 'proceedings'. + """ + updated_minimal_record["metadata"]["resource_type"][ + "id" + ] = "publication-conferenceproceeding" + + serializer = BibtexSerializer() + serialized_record = serializer.serialize_object(updated_minimal_record) + + expected_data = "\n".join( + [ + "@proceedings{brown_2023_abcde-fghij,", + " title = {A Romans story},", + " year = 2023,", + " publisher = {Acme Inc},", + " month = mar,", + "}", + ] + ) + + assert serialized_record == expected_data + + def test_serialize_publication_book(running_app, updated_minimal_record): """Test bibtex formatter for books.