diff --git a/exportsrv/formatter/bibTexFormat.py b/exportsrv/formatter/bibTexFormat.py index d29c0b1..3db2b94 100755 --- a/exportsrv/formatter/bibTexFormat.py +++ b/exportsrv/formatter/bibTexFormat.py @@ -84,6 +84,11 @@ def __get_doc_type(self, solr_type): :param solr_type: :return: """ + try: + has_publisher = self.from_solr['response'].get('docs')[0].get('publisher') + except: + has_publisher = None + fields = {'article':'@ARTICLE', 'circular':'@ARTICLE', 'newsletter':'@ARTICLE', 'bookreview':'@ARTICLE', 'erratum':'@ARTICLE', 'obituary':'@ARTICLE', 'eprint':'@ARTICLE', 'catalog':'@ARTICLE', 'editorial':'@ARTICLE', @@ -94,8 +99,11 @@ def __get_doc_type(self, solr_type): 'misc':'@MISC', 'proposal':'@MISC', 'pressrelease':'@MISC', 'talk':'@MISC', 'software':'@software', 'dataset':'@dataset', 'phdthesis':'@PHDTHESIS','mastersthesis':'@MASTERSTHESIS', - 'techreport':'@MISC', 'intechreport':'@MISC','instrument':'@MISC','service':'@MISC'} - return fields.get(solr_type, '') + 'techreport':'@TECHREPORT', 'intechreport':'@MISC','instrument':'@MISC','service':'@MISC'} + doc_type = fields.get(solr_type, '') + if doc_type == '@TECHREPORT' and not has_publisher: + doc_type = '@MISC' + return doc_type def __format_date(self, solr_date): @@ -176,13 +184,11 @@ def __get_fields(self, a_doc): fields = [('author', 'author'), ('title', 'title'), ('keyword', 'keywords'), ('aff', 'school'), ('year', 'year'), ('month', 'month'), ('bibcode', 'adsurl'),('adsnotes', 'adsnote')] - # 2/14 mapping techreport and intechreport to @MISC per Markus request for now - # elif (doc_type_bibtex == '@TECHREPORT'): - # fields = [('author', 'author'), ('title', 'title'), ('pub_raw', 'journal'), - # ('keyword', 'keywords'), ('pub', 'booktitle'), ('year', 'year'), - # ('editor', 'editor'), ('series', 'series'), ('month', 'month'), - # ('eid', 'eid'), ('page_range', 'pages'), ('volume', 'volume'), - # ('doi', 'doi'), ('bibcode', 'adsurl'), ('adsnotes', 'adsnote')] + elif (doc_type_bibtex == '@TECHREPORT'): + fields = [('author', 'author'), ('title', 'title'), ('publisher', 'institution'), + ('keyword', 'keywords'), ('year', 'year'), + ('eid', 'number'), ('pub_raw', 'howpublished'), + ('doi', 'doi'), ('bibcode', 'adsurl'), ('adsnotes', 'adsnote')] # 1/31/2024 as per Edwin adding software and dataset export format elif doc_type_bibtex in ['@software', '@dataset']: fields = [('author', 'author'), ('title', 'title'), @@ -486,7 +492,6 @@ def __get_doc(self, index, include_abs, max_author, author_cutoff, journal_forma a_doc = self.from_solr['response'].get('docs')[index] text = self.__get_doc_type(a_doc.get('doctype', '')) + '{' + self.__get_key(index) + ',\n' - fields = self.__get_fields(a_doc) for field in fields: if (field == 'author') or (field == 'editor'): @@ -536,7 +541,6 @@ def __get_doc(self, index, include_abs, max_author, author_cutoff, journal_forma # remove the last comma, text = text[:-len(',\n')] + '\n' - return text + '}' diff --git a/exportsrv/tests/unittests/stubdata/bibTexTest.py b/exportsrv/tests/unittests/stubdata/bibTexTest.py index 151e763..c64fe4b 100644 --- a/exportsrv/tests/unittests/stubdata/bibTexTest.py +++ b/exportsrv/tests/unittests/stubdata/bibTexTest.py @@ -6,4 +6,8 @@ data_publisher = {'msg': 'Retrieved 5 abstracts, starting with number 1.', 'export': '@software{2024zndo..10908474S,\n author = {{Schade}, Robert},\n title = "{pc2/pqdts: v2024.2}",\n year = 2024,\n month = apr,\n eid = {10.5281/zenodo.10908474},\n doi = {10.5281/zenodo.10908474},\n version = {v2024.2},\n publisher = {Zenodo},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024zndo..10908474S},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INPROCEEDINGS{2024wsp..conf...20V,\n author = {{Vidmachenko}, A.},\n title = "{A modern view of former rivers on Mars.}",\n keywords = {Mars, riverbeds, meandering valleys, glaciers, eternal permafrost},\n booktitle = {Proceedings of the VIII International Scientific and Practical Conference. World science priorities (February 08 {\\textendash} 09},\n year = 2024,\n month = feb,\n publisher = {World of Conferences},\n pages = {20-25},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024wsp..conf...20V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INCOLLECTION{2024asal.book..204V,\n author = {{Vidmachenko}, A.},\n title = "{New generation telescopes for the astronomy of the future.}",\n keywords = {new astronomical instruments, Telescopes, telescope construction, astronomical research},\n booktitle = {In book: Astronomical almanac},\n year = 2024,\n publisher = {Kyiv},\n pages = {204-209},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024asal.book..204V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@PROCEEDINGS{2018scrp.conf.....K,\n title = "{Science and Computing with Raspberry Pi}",\n keywords = {single board computing, astronomy, very large array, astrophysics, visualization, data science, computing, radio astronomy},\n booktitle = {Science and Computing with Raspberry Pi},\n year = 2018,\n month = jul,\n publisher = {Morgan & Claypool},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2018scrp.conf.....K},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@BOOK{2023uwff.book.....R,\n author = {{Renwick}, J.~A.},\n title = "{Under the weather: a future forecast for New Zealand}",\n year = 2023,\n publisher = {HarperCollins},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2023uwff.book.....R},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n'} -data_with_abs_publisher = {'msg': 'Retrieved 5 abstracts, starting with number 1.', 'export': '@software{2024zndo..10908474S,\n author = {{Schade}, Robert},\n title = "{pc2/pqdts: v2024.2}",\n year = 2024,\n month = apr,\n eid = {10.5281/zenodo.10908474},\n doi = {10.5281/zenodo.10908474},\n version = {v2024.2},\n publisher = {Zenodo},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024zndo..10908474S},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INPROCEEDINGS{2024wsp..conf...20V,\n author = {{Vidmachenko}, A.},\n title = "{A modern view of former rivers on Mars.}",\n keywords = {Mars, riverbeds, meandering valleys, glaciers, eternal permafrost},\n booktitle = {Proceedings of the VIII International Scientific and Practical Conference. World science priorities (February 08 {\\textendash} 09},\n year = 2024,\n month = feb,\n publisher = {World of Conferences},\n pages = {20-25},\n abstract = "{Now the surface of Mars is a waterless desert, over which storms rage,\n raising sand and dust to a height of tens of kilometers. Under\n modern conditions, open bodies of water cannot exist on Mars.\n And water on the planet is contained either in the soil layer as\n permafrost, or in the form of open ice and snow; a very small\n amount of water is present in gaseous form in the atmosphere.\n The large reservoirs of water ice on Mars are the polar caps.\n Studies of Mars by spacecraft have shown that there is a huge\n amount of ice, and possibly liquid water, under the surface\n layer at a shallow depth. Analysis of the collected data allowed\n us to come to the conclusion that liquid water existed in\n significant quantities on the surface of Mars several billion\n years ago. That is, in the past, Mars had a full-fledged\n hydrosphere and a rather powerful atmosphere with a pressure\n near the surface of more than 0.4 bar. Later, the planet\'s\n climate changed. It lost much of its atmosphere and water,\n turning into a cold world. On the surface of Mars, there are\n numerous winding valleys with a long length, reminiscent of the\n dried-up channels of terrestrial rivers. A significant portion\n of the water that once flowed along currently dry riverbeds must\n now be under the surface of the planet. It is also possible that\n some channels are the result of the action of not liquid water,\n but a mixture of mud, ice and steam that flow only episodically.\n It is possible that the meandering valleys formed moving masses\n of glaciers. There is every reason to believe that there is\n still a lot of water on Mars, and it still exists in the form of\n permafrost. A perspective image of the Echus Chasma region\n suggests that liquid water was present on this part of the\n Martian surface up to a billion years ago. Later, the planet\n cooled down, the lakes froze, and glaciers formed, which \'cut\'\n the Kasei Valles with their streams.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024wsp..conf...20V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INCOLLECTION{2024asal.book..204V,\n author = {{Vidmachenko}, A.},\n title = "{New generation telescopes for the astronomy of the future.}",\n keywords = {new astronomical instruments, Telescopes, telescope construction, astronomical research},\n booktitle = {In book: Astronomical almanac},\n year = 2024,\n publisher = {Kyiv},\n pages = {204-209},\n abstract = "{In the next few years, several new astronomical instruments are planned\n to be launched on Earth and in space. Each of these devices is\n very expensive! But many countries allocate large amounts of\n money for this, and plan to receive more and more recent data\n about the surrounding universe. Telescopes are devices for\n observing distant objects. The very first working telescope was\n created in 1608 by the Dutch optician Hans Lippersgei. The\n creation of the telescope was also attributed to such masters as\n another Dutch eyeglass maker from Middelburg, Zachary Janssen,\n and Jacob Mathews from the city of Alkmaar. These earliest\n telescopes consisted of a convex lens as an objective and a\n concave lens that served as an eyepiece. In 1609, Galileo\n Galilei significantly improved the design of the telescope,\n achieving a 30-fold increase in the original images. With its\n help, Galileo performed the first survey of the heavenly bodies.\n Therefore, even now, the creation of astronomical instruments,\n whose characteristics significantly improve previous examples of\n telescope construction, is considered extremely important in\n astronomical research. The Hubble telescope was the first to\n provide interesting information about the features of images of\n the most distant galaxies. They are significantly different from\n those formed relatively recently. One of the world\'s largest\n ground-based telescopes, the Giant Magellan Telescope, is under\n construction. It is being built in Chile and its gradual\n commissioning will begin in 2024. Segments of seven monolithic\n mirrors, with a diameter of 8.4 m each, create an optical\n surface with an equivalent diameter of 24.5 m. Larger will be\n the 30-meter telescope, which is planned to be built on the\n island of Hawaii, next to the two 9-meter Keck reflectors at the\n Mauna Kea observatory. The mirror surface of this telescope will\n consist of almost five hundred hexagonal segments and will reach\n a diameter of 30 m. It is expected to be tested in 2027. In\n 2014, the European Southern Observatory started the construction\n of the Extremely Large Telescope. In 2025, it is planned to\n become the most powerful optical astronomical instrument in the\n world, with an equivalent diameter of its mirror surface of 39\n m.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024asal.book..204V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@PROCEEDINGS{2018scrp.conf.....K,\n title = "{Science and Computing with Raspberry Pi}",\n keywords = {single board computing, astronomy, very large array, astrophysics, visualization, data science, computing, radio astronomy},\n booktitle = {Science and Computing with Raspberry Pi},\n year = 2018,\n month = jul,\n publisher = {Morgan & Claypool},\n abstract = "{The portable Raspberry Pi computing platform with the power of Linux\n yields an exciting exploratory tool for beginning scientific\n computing. Science and Computing with Raspberry Pi takes the\n reader through explorations in a variety of computing exercises\n with the physical sciences. The book guides the user through:\n configuring your Raspberry Pi and Linux operating system;\n understanding the software requirements while using the Pi for\n scientific computing; computing exercises in physics, astronomy,\n chaos theory, and machine learning.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2018scrp.conf.....K},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@BOOK{2023uwff.book.....R,\n author = {{Renwick}, J.~A.},\n title = "{Under the weather: a future forecast for New Zealand}",\n year = 2023,\n publisher = {HarperCollins},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2023uwff.book.....R},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n'} \ No newline at end of file +data_with_abs_publisher = {'msg': 'Retrieved 5 abstracts, starting with number 1.', 'export': '@software{2024zndo..10908474S,\n author = {{Schade}, Robert},\n title = "{pc2/pqdts: v2024.2}",\n year = 2024,\n month = apr,\n eid = {10.5281/zenodo.10908474},\n doi = {10.5281/zenodo.10908474},\n version = {v2024.2},\n publisher = {Zenodo},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024zndo..10908474S},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INPROCEEDINGS{2024wsp..conf...20V,\n author = {{Vidmachenko}, A.},\n title = "{A modern view of former rivers on Mars.}",\n keywords = {Mars, riverbeds, meandering valleys, glaciers, eternal permafrost},\n booktitle = {Proceedings of the VIII International Scientific and Practical Conference. World science priorities (February 08 {\\textendash} 09},\n year = 2024,\n month = feb,\n publisher = {World of Conferences},\n pages = {20-25},\n abstract = "{Now the surface of Mars is a waterless desert, over which storms rage,\n raising sand and dust to a height of tens of kilometers. Under\n modern conditions, open bodies of water cannot exist on Mars.\n And water on the planet is contained either in the soil layer as\n permafrost, or in the form of open ice and snow; a very small\n amount of water is present in gaseous form in the atmosphere.\n The large reservoirs of water ice on Mars are the polar caps.\n Studies of Mars by spacecraft have shown that there is a huge\n amount of ice, and possibly liquid water, under the surface\n layer at a shallow depth. Analysis of the collected data allowed\n us to come to the conclusion that liquid water existed in\n significant quantities on the surface of Mars several billion\n years ago. That is, in the past, Mars had a full-fledged\n hydrosphere and a rather powerful atmosphere with a pressure\n near the surface of more than 0.4 bar. Later, the planet\'s\n climate changed. It lost much of its atmosphere and water,\n turning into a cold world. On the surface of Mars, there are\n numerous winding valleys with a long length, reminiscent of the\n dried-up channels of terrestrial rivers. A significant portion\n of the water that once flowed along currently dry riverbeds must\n now be under the surface of the planet. It is also possible that\n some channels are the result of the action of not liquid water,\n but a mixture of mud, ice and steam that flow only episodically.\n It is possible that the meandering valleys formed moving masses\n of glaciers. There is every reason to believe that there is\n still a lot of water on Mars, and it still exists in the form of\n permafrost. A perspective image of the Echus Chasma region\n suggests that liquid water was present on this part of the\n Martian surface up to a billion years ago. Later, the planet\n cooled down, the lakes froze, and glaciers formed, which \'cut\'\n the Kasei Valles with their streams.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024wsp..conf...20V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@INCOLLECTION{2024asal.book..204V,\n author = {{Vidmachenko}, A.},\n title = "{New generation telescopes for the astronomy of the future.}",\n keywords = {new astronomical instruments, Telescopes, telescope construction, astronomical research},\n booktitle = {In book: Astronomical almanac},\n year = 2024,\n publisher = {Kyiv},\n pages = {204-209},\n abstract = "{In the next few years, several new astronomical instruments are planned\n to be launched on Earth and in space. Each of these devices is\n very expensive! But many countries allocate large amounts of\n money for this, and plan to receive more and more recent data\n about the surrounding universe. Telescopes are devices for\n observing distant objects. The very first working telescope was\n created in 1608 by the Dutch optician Hans Lippersgei. The\n creation of the telescope was also attributed to such masters as\n another Dutch eyeglass maker from Middelburg, Zachary Janssen,\n and Jacob Mathews from the city of Alkmaar. These earliest\n telescopes consisted of a convex lens as an objective and a\n concave lens that served as an eyepiece. In 1609, Galileo\n Galilei significantly improved the design of the telescope,\n achieving a 30-fold increase in the original images. With its\n help, Galileo performed the first survey of the heavenly bodies.\n Therefore, even now, the creation of astronomical instruments,\n whose characteristics significantly improve previous examples of\n telescope construction, is considered extremely important in\n astronomical research. The Hubble telescope was the first to\n provide interesting information about the features of images of\n the most distant galaxies. They are significantly different from\n those formed relatively recently. One of the world\'s largest\n ground-based telescopes, the Giant Magellan Telescope, is under\n construction. It is being built in Chile and its gradual\n commissioning will begin in 2024. Segments of seven monolithic\n mirrors, with a diameter of 8.4 m each, create an optical\n surface with an equivalent diameter of 24.5 m. Larger will be\n the 30-meter telescope, which is planned to be built on the\n island of Hawaii, next to the two 9-meter Keck reflectors at the\n Mauna Kea observatory. The mirror surface of this telescope will\n consist of almost five hundred hexagonal segments and will reach\n a diameter of 30 m. It is expected to be tested in 2027. In\n 2014, the European Southern Observatory started the construction\n of the Extremely Large Telescope. In 2025, it is planned to\n become the most powerful optical astronomical instrument in the\n world, with an equivalent diameter of its mirror surface of 39\n m.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2024asal.book..204V},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@PROCEEDINGS{2018scrp.conf.....K,\n title = "{Science and Computing with Raspberry Pi}",\n keywords = {single board computing, astronomy, very large array, astrophysics, visualization, data science, computing, radio astronomy},\n booktitle = {Science and Computing with Raspberry Pi},\n year = 2018,\n month = jul,\n publisher = {Morgan & Claypool},\n abstract = "{The portable Raspberry Pi computing platform with the power of Linux\n yields an exciting exploratory tool for beginning scientific\n computing. Science and Computing with Raspberry Pi takes the\n reader through explorations in a variety of computing exercises\n with the physical sciences. The book guides the user through:\n configuring your Raspberry Pi and Linux operating system;\n understanding the software requirements while using the Pi for\n scientific computing; computing exercises in physics, astronomy,\n chaos theory, and machine learning.}",\n adsurl = {https://ui.adsabs.harvard.edu/abs/2018scrp.conf.....K},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n@BOOK{2023uwff.book.....R,\n author = {{Renwick}, J.~A.},\n title = "{Under the weather: a future forecast for New Zealand}",\n year = 2023,\n publisher = {HarperCollins},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2023uwff.book.....R},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n'} + +data_techreport_without_publisher = {'msg': 'Retrieved 1 abstracts, starting with number 1.', 'export': '@MISC{2017wfc..rept...16R,\n author = {{Ryan}, R.~E. and {McCullough}, P.~R.},\n title = "{Possible Overlaps Between Blobs, Grism Apertures, and Dithers}",\n keywords = {Hubble Space Telescope, HST, Space Telescope Science Institute, STScI, WFC3, infrared blobs, IR blobs},\n howpublished = {Instrument Science Report WFC3 2017-16, 6 pages},\n year = 2017,\n month = jun,\n pages = {16},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2017wfc..rept...16R},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n'} + +data_techreport_with_publisher = {'msg': 'Retrieved 1 abstracts, starting with number 1.', 'export': '@TECHREPORT{2025romanrept..742B,\n author = {{Brandt}, Timothy},\n title = "{Quantifying the Science Performance of Multi-Accumulation (MA) Tables}",\n institution = {STScI},\n year = 2025,\n number = {Technical Report Roman-STScI-000742},\n howpublished = {Nancy Grace Roman Space Telescope Technical Report Roman-STScI-000742, 10 pp.},\n adsurl = {https://ui.adsabs.harvard.edu/abs/2025romanrept..742B},\n adsnote = {Provided by the SAO/NASA Astrophysics Data System}\n}\n\n'} diff --git a/exportsrv/tests/unittests/stubdata/solrdata.py b/exportsrv/tests/unittests/stubdata/solrdata.py index 437f6a6..b5d9870 100644 --- a/exportsrv/tests/unittests/stubdata/solrdata.py +++ b/exportsrv/tests/unittests/stubdata/solrdata.py @@ -715,6 +715,137 @@ } } +data_4_publisher = \ +{ + u'responseHeader': { + u'status': 0, + u'QTime': 12, + u'params': { + u'q': u'bibcode:2025romanrept..742B', + u'indent': u'true', + u'fl': u'*', + u'q.op': u'OR', + u'useParams': u'', + u'_': u'1755860969651' + } + }, + u'response': { + u'numFound': 1, + u'start': 0, + u'docs': [ + { + u'bibcode': u'2025romanrept..742B', + u'abstract': u'The Nancy Grace Roman Space Telescope has ...', + u'aff': [ + u'Space Telescope Science Institute' + ], + u'author': [ + u'Brandt, Timothy' + ], + u'author_count': 1, + u'author_norm': [ + u'Brandt, T' + ], + u'bibstem': [ + u'roman', + u'romanrept' + ], + u'comment': [ + u'In publications, please refer to this document as: Brandt, Timothy. 2025, Quantifying the Science Performance of Multi-Accumulation (MA) Tables, Technical Report Roman-STScI-000742 (Baltimore: STScI)' + ], + u'database': [ + u'astronomy' + ], + u'date': u'2025-01-01T00:00:00Z', + u'doctype': u'techreport', + u'doctype_facet_hier': [ + u'0/Non-Article', + u'1/Non-Article/Tech Report' + ], + u'eid': u'Technical Report Roman-STScI-000742', + u'email': [ + u'-' + ], + u'first_author': u'Brandt, Timothy', + u'first_author_norm': u'Brandt, T', + u'id': u'35435758', + u'recid': 35435758, + u'identifier': [ + u'2025romanrept..742B' + ], + u'orcid_pub': [ + u'-' + ], + u'page': [ + u'Technical Report Roman-STScI-000742' + ], + u'pub': u'Nancy Grace Roman Space Telescope Technical Report Roman-STScI-000742', + u'pub_raw': u'Nancy Grace Roman Space Telescope Technical Report Roman-STScI-000742, 10 pp.', + u'pubdate': u'2025-01-00', + u'title': [ + u'Quantifying the Science Performance of Multi-Accumulation (MA) Tables' + ], + u'year': u'2025', + u'page_count': 10, + u'entry_date': u'2025-07-20T00:00:00Z', + u'publisher': u'STScI', + u'aff_abbrev': [ + u'STScI/STScI' + ], + u'aff_canonical': [ + u'Space Telescope Science Institute, Baltimore, Maryland' + ], + u'aff_id': [ + u'A03671' + ], + u'institution': [ + u'STScI/STScI' + ], + u'read_count': 0, + u'cite_read_boost': 0.16, + u'classic_factor': 0, + u'esources': [ + u'PUB_PDF' + ], + u'property': [ + u'ESOURCE', + u'NONARTICLE', + u'NOT REFEREED', + u'OPENACCESS', + u'PUB_OPENACCESS' + ], + u'citation_count': 0, + u'citation_count_norm': 0.0, + u'metadata_mtime': u'2025-08-18T13:34:31.905Z', + u'nonbib_mtime': u'2025-08-22T08:18:27.099Z', + u'metrics_mtime': u'2025-08-22T08:18:27.100Z', + u'update_timestamp': u'2025-08-22T08:18:27.100Z', + u'scix_id': u'scix:5DNS-FKRY-8FDH', + u'doctype_boost': 0.71428573, + u'has': [ + u'abstract', + u'aff', + u'aff_id', + u'author', + u'comment', + u'database', + u'doctype', + u'first_author', + u'identifier', + u'institution', + u'property', + u'pub', + u'pub_raw', + u'publisher', + u'title' + ], + u'_version_': 1841146643046465536, + u'indexstamp': u'2025-08-22T09:17:45.465Z' + } + ] + } +} + data_5 = \ { u'responseHeader': { diff --git a/exportsrv/tests/unittests/test_export_service.py b/exportsrv/tests/unittests/test_export_service.py index a449296..7e2d890 100755 --- a/exportsrv/tests/unittests/test_export_service.py +++ b/exportsrv/tests/unittests/test_export_service.py @@ -817,6 +817,15 @@ def test_misc_with_and_without_publiser(self): bibtex_export = BibTexFormat(solrdata.data_16, "%R").get(include_abs=False, max_author=10, author_cutoff=200, journal_format=3, output_format=1).get('export', '') assert(bibtex_export == expected_bibtex_export) + def test_techreport_without_publisher(self): + # Testing that BibTeX for records of type techreport without publisher get @MISC + bibtex_export = BibTexFormat(solrdata.data_4, "%R").get(include_abs=False, max_author=10, author_cutoff=200, journal_format=3, output_format=1) + assert(bibtex_export == bibTexTest.data_techreport_without_publisher) + + def test_techreport_with_publisher(self): + # Testing that BibTeX for records of type techreport with publisher get @TECHREPORT + bibtex_export = BibTexFormat(solrdata.data_4_publisher, "%R").get(include_abs=False, max_author=10, author_cutoff=200, journal_format=3, output_format=1) + assert(bibtex_export == bibTexTest.data_techreport_with_publisher) def test_bibtex_publisher(self): """ format the publisher stubdata using the code """