Skip to content

Commit

Permalink
serializers: bibtex: Conference paper not falling back to proceedings
Browse files Browse the repository at this point in the history
  • Loading branch information
ptamarit committed Dec 18, 2024
1 parent 834976d commit 288af91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 1 addition & 4 deletions invenio_rdm_records/resources/serializers/bibtex/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class BibTexSchema(BaseSerializerSchema, CommonFieldsMixin):

entry_mapper = {
# Publication fields
"publication-conferencepaper": [
BibTexFormatter.in_proceedings,
BibTexFormatter.proceedings,
],
"publication-conferencepaper": [BibTexFormatter.in_proceedings],
"publication-book": [
BibTexFormatter.book,
BibTexFormatter.booklet,
Expand Down
10 changes: 6 additions & 4 deletions tests/resources/serializers/test_bibtex_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_serialize_publication_conferencepaper(running_app, updated_minimal_reco
It serializes into the following formats, depending on the data:
- inproceedings
- proceedings
- misc
"""
updated_minimal_record["metadata"]["resource_type"][
"id"
Expand Down Expand Up @@ -178,23 +178,25 @@ def test_serialize_publication_conferencepaper(running_app, updated_minimal_reco

assert serialized_record == expected_data

# Force serialization into 'proceedings'
# Force serialization into 'misc'
del updated_minimal_record["custom_fields"]["imprint:imprint"]
serialized_record = serializer.serialize_object(updated_minimal_record)

expected_data = "\n".join(
[
"@proceedings{brown_2023_abcde-fghij,",
"@misc{brown_2023_abcde-fghij,",
" author = {Name and",
" Troy Inc.},",
" title = {A Romans story},",
" month = mar,",
" 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.
Expand Down

0 comments on commit 288af91

Please sign in to comment.