Skip to content

Commit fe98eb1

Browse files
committed
Fix bibtex unittest
1 parent 2d09680 commit fe98eb1

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

test_module.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -685,33 +685,18 @@ def test_search_pubs_citedby_id(self):
685685
pubs = [p for p in scholarly.search_citedby(publication_id)]
686686
self.assertGreaterEqual(len(pubs), 11)
687687

688-
@unittest.skip(reason="The BiBTeX comparison is not reliable")
689688
def test_bibtex(self):
690689
"""
691690
Test that we get the BiBTeX entry correctly
692691
"""
693692

694-
expected_result = \
695-
("""@inproceedings{ester1996density,
696-
abstract = {Clustering algorithms are attractive for the task of class identification in spatial databases. """
697-
"""However, the application to large spatial databases rises the following requirements for clustering algorithms: """
698-
"""minimal requirements of domain knowledge to determine the input},
699-
author = {Ester, Martin and Kriegel, Hans-Peter and Sander, J{\\"o}rg and Xu, Xiaowei and others},
700-
booktitle = {kdd},
701-
number = {34},
702-
pages = {226--231},
703-
pub_year = {1996},
704-
title = {A density-based algorithm for discovering clusters in large spatial databases with noise.},
705-
venue = {kdd},
706-
volume = {96}
707-
}
693+
with open("testdata/bibtex.txt", "r") as f:
694+
expected_result = "".join(f.readlines())
708695

709-
"""
710-
)
711-
pub = scholarly.search_single_pub("A density-based algorithm for discovering clusters in large "
712-
"spatial databases with noise", filled=True)
696+
pub = scholarly.search_single_pub("A distribution-based clustering algorithm for mining in large "
697+
"spatial databases", filled=True)
713698
result = scholarly.bibtex(pub)
714-
self.assertEqual(result, expected_result.replace("\n ", "\n"))
699+
self.assertEqual(result, expected_result)
715700

716701
def test_search_pubs(self):
717702
"""

testdata/test_bibtex_result.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@inproceedings{xu1998distribution,
2+
abstract = {The problem of detecting clusters of points belonging to a spatial point process arises in many applications. In this paper, we introduce the new clustering algorithm DBCLASD (Distribution-Based Clustering of LArge Spatial Databases) to discover clusters of this type. The results of experiments demonstrate that DBCLASD, contrary to partitioning algorithms such as CLARANS (Clustering Large Applications based on RANdomized Search), discovers clusters of arbitrary shape. Furthermore, DBCLASD does not require any input},
3+
author = {Xu, Xiaowei and Ester, Martin and Kriegel, H-P and Sander, J{\"o}rg},
4+
booktitle = {Proceedings 14th International Conference on Data Engineering},
5+
organization = {IEEE},
6+
pages = {324--331},
7+
pub_year = {1998},
8+
title = {A distribution-based clustering algorithm for mining in large spatial databases},
9+
url = {https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=933cba585a12e56a8f60511ebeb74b8cb42634b1},
10+
venue = {… Conference on Data …}
11+
}

0 commit comments

Comments
 (0)