|
| 1 | +"""Test citations.""" |
1 | 2 | import pytest |
2 | 3 |
|
3 | 4 | from .. import api |
|
11 | 12 | "https://doi.org/10.1007/3-540-48714-X_16", |
12 | 13 | ] |
13 | 14 |
|
14 | | -mni2009_fbib = ( |
15 | | - "@article{mni152nlin2009casym1,\n" |
16 | | - "\tdoi = {10.1016/j.neuroimage.2010.07.033},\n" |
17 | | - "\turl = {https://doi.org/10.1016%2Fj.neuroimage.2010.07.033},\n" |
18 | | - "\tyear = 2011,\n" |
19 | | - "\tmonth = {jan},\n" |
20 | | - "\tpublisher = {Elsevier {BV}},\n" |
21 | | - "\tvolume = {54},\n" |
22 | | - "\tnumber = {1},\n" |
23 | | - "\tpages = {313--327},\n" |
24 | | - "\tauthor = {Vladimir Fonov and Alan C. Evans and Kelly Botteron and C. " |
25 | | - "Robert Almli and Robert C. McKinstry and D. Louis Collins},\n" |
26 | | - "\ttitle = {Unbiased average age-appropriate atlases for pediatric studies},\n" |
27 | | - "\tjournal = {{NeuroImage}}\n}" |
28 | | -) |
| 15 | +mni2009_fbib = """\ |
| 16 | +@article{Fonov_2011, |
| 17 | +\tdoi = {10.1016/j.neuroimage.2010.07.033}, |
| 18 | +\turl = {https://doi.org/10.1016%2Fj.neuroimage.2010.07.033}, |
| 19 | +\tyear = 2011, |
| 20 | +\tmonth = {jan}, |
| 21 | +\tpublisher = {Elsevier {BV}}, |
| 22 | +\tvolume = {54}, |
| 23 | +\tnumber = {1}, |
| 24 | +\tpages = {313--327}, |
| 25 | +\tauthor = {Vladimir Fonov and Alan C. Evans and Kelly Botteron and C. Robert \ |
| 26 | +Almli and Robert C. McKinstry and D. Louis Collins}, |
| 27 | +\ttitle = {Unbiased average age-appropriate atlases for pediatric studies}, |
| 28 | +\tjournal = {{NeuroImage}} |
| 29 | +}""" |
29 | 30 |
|
30 | | -mni2009_lbib = ( |
31 | | - "@incollection{mni152nlin2009casym4,\n" |
32 | | - "\tdoi = {10.1007/3-540-48714-x_16},\n" |
33 | | - "\turl = {https://doi.org/10.1007%2F3-540-48714-x_16},\n" |
34 | | - "\tyear = 1999,\n" |
35 | | - "\tpublisher = {Springer Berlin Heidelberg},\n" |
36 | | - "\tpages = {210--223},\n" |
37 | | - "\tauthor = {D. Louis Collins and Alex P. Zijdenbos and Wim F. C. " |
38 | | - "Baar{\\'{e}} and Alan C. Evans},\n" |
39 | | - "\ttitle = {{ANIMAL}$\\mathplus${INSECT}: Improved Cortical Structure " |
40 | | - "Segmentation},\n" |
41 | | - "\tbooktitle = {Lecture Notes in Computer Science}\n}" |
42 | | -) |
| 31 | +mni2009_lbib = """\ |
| 32 | +@incollection{Collins_1999, |
| 33 | +\tdoi = {10.1007/3-540-48714-x_16}, |
| 34 | +\turl = {https://doi.org/10.1007%2F3-540-48714-x_16}, |
| 35 | +\tyear = 1999, |
| 36 | +\tpublisher = {Springer Berlin Heidelberg}, |
| 37 | +\tpages = {210--223}, |
| 38 | +\tauthor = {D. Louis Collins and Alex P. Zijdenbos and Wim F. C. Baar{\\'{e}} and Alan C. Evans}, |
| 39 | +\ttitle = {{ANIMAL}$\\mathplus${INSECT}: Improved Cortical Structure Segmentation}, |
| 40 | +\tbooktitle = {Lecture Notes in Computer Science} |
| 41 | +}""" |
43 | 42 |
|
44 | 43 | fslr_urls = [ |
45 | 44 | "https://doi.org/10.1093/cercor/bhr291", |
46 | 45 | "https://github.com/Washington-University/HCPpipelines/tree/master/global/templates", |
47 | 46 | ] |
48 | 47 |
|
49 | | -fslr_fbib = ( |
50 | | - "@article{fslr1,\n" |
51 | | - "\tdoi = {10.1093/cercor/bhr291},\n" |
52 | | - "\turl = {https://doi.org/10.1093%2Fcercor%2Fbhr291},\n" |
53 | | - "\tyear = 2011,\n" |
54 | | - "\tmonth = {nov},\n" |
55 | | - "\tpublisher = {Oxford University Press ({OUP})},\n" |
56 | | - "\tvolume = {22},\n" |
57 | | - "\tnumber = {10},\n" |
58 | | - "\tpages = {2241--2262},\n" |
59 | | - "\tauthor = {D. C. Van Essen and M. F. Glasser and D. L. Dierker and J. " |
60 | | - "Harwell and T. Coalson},\n" |
61 | | - "\ttitle = {Parcellations and Hemispheric Asymmetries of Human Cerebral " |
62 | | - "Cortex Analyzed on Surface-Based Atlases},\n" |
63 | | - "\tjournal = {Cerebral Cortex}\n}" |
64 | | -) |
| 48 | +fslr_fbib = """\ |
| 49 | +@article{Van_Essen_2011, |
| 50 | +\tdoi = {10.1093/cercor/bhr291}, |
| 51 | +\turl = {https://doi.org/10.1093%2Fcercor%2Fbhr291}, |
| 52 | +\tyear = 2011, |
| 53 | +\tmonth = {nov}, |
| 54 | +\tpublisher = {Oxford University Press ({OUP})}, |
| 55 | +\tvolume = {22}, |
| 56 | +\tnumber = {10}, |
| 57 | +\tpages = {2241--2262}, |
| 58 | +\tauthor = {D. C. Van Essen and M. F. Glasser and D. L. Dierker and J. Harwell and T. Coalson}, |
| 59 | +\ttitle = {Parcellations and Hemispheric Asymmetries of Human Cerebral Cortex Analyzed on \ |
| 60 | +Surface-Based Atlases}, |
| 61 | +\tjournal = {Cerebral Cortex} |
| 62 | +}""" |
65 | 63 |
|
66 | 64 | fslr_lbib = ( |
67 | 65 | "https://github.com/Washington-University/HCPpipelines/tree/master/global/templates" |
|
77 | 75 | ], |
78 | 76 | ) |
79 | 77 | def test_citations(tmp_path, template, urls, fbib, lbib): |
| 78 | + """Check the correct composition of citations.""" |
80 | 79 | assert api.get_citations(template) == urls |
81 | 80 | bibs = api.get_citations(template, bibtex=True) |
82 | 81 | if bibs: |
83 | | - assert bibs[0] == fbib |
84 | | - assert bibs[-1] == lbib |
| 82 | + assert "".join(bibs[0]) == fbib |
| 83 | + assert "".join(bibs[-1]) == lbib |
85 | 84 | else: |
86 | 85 | # no citations currently |
87 | 86 | assert template == "fsaverage" |
0 commit comments