Skip to content

Commit

Permalink
Fix bibtex unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Jun 18, 2023
1 parent 2d09680 commit fe98eb1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
25 changes: 5 additions & 20 deletions test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,33 +685,18 @@ def test_search_pubs_citedby_id(self):
pubs = [p for p in scholarly.search_citedby(publication_id)]
self.assertGreaterEqual(len(pubs), 11)

@unittest.skip(reason="The BiBTeX comparison is not reliable")
def test_bibtex(self):
"""
Test that we get the BiBTeX entry correctly
"""

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

"""
)
pub = scholarly.search_single_pub("A density-based algorithm for discovering clusters in large "
"spatial databases with noise", filled=True)
pub = scholarly.search_single_pub("A distribution-based clustering algorithm for mining in large "
"spatial databases", filled=True)
result = scholarly.bibtex(pub)
self.assertEqual(result, expected_result.replace("\n ", "\n"))
self.assertEqual(result, expected_result)

def test_search_pubs(self):
"""
Expand Down
11 changes: 11 additions & 0 deletions testdata/test_bibtex_result.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@inproceedings{xu1998distribution,
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},
author = {Xu, Xiaowei and Ester, Martin and Kriegel, H-P and Sander, J{\"o}rg},
booktitle = {Proceedings 14th International Conference on Data Engineering},
organization = {IEEE},
pages = {324--331},
pub_year = {1998},
title = {A distribution-based clustering algorithm for mining in large spatial databases},
url = {https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=933cba585a12e56a8f60511ebeb74b8cb42634b1},
venue = {… Conference on Data …}
}

0 comments on commit fe98eb1

Please sign in to comment.