Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97877552
ut_citeseer.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jan 7, 02:25
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jan 9, 02:25 (2 d)
Engine
blob
Format
Raw Data
Handle
23425725
Attached To
R3596 pybliographer
ut_citeseer.py
View Options
# -*- coding: utf-8 -*-
import
pybut
,
sys
,
os
,
logging
from
twisted.trial
import
unittest
from
Pyblio.External
import
Citeseer
base
=
os
.
path
.
abspath
(
'ut_citeseer'
)
class
TestScraping
(
unittest
.
TestCase
):
def
testScrape
(
self
):
scrape
=
Citeseer
.
ResultScraper
(
open
(
os
.
path
.
join
(
base
,
'result.html'
))
.
read
())
self
.
failUnlessEqual
(
214
,
scrape
.
count
())
links
=
scrape
.
links
()
self
.
failUnlessEqual
(
links
[
0
],
'http://citeseer.ist.psu.edu/fredriksson01faster.html'
)
def
testNoResults
(
self
):
scrape
=
Citeseer
.
ResultScraper
(
open
(
os
.
path
.
join
(
base
,
'noresult.html'
))
.
read
())
self
.
failUnlessEqual
(
0
,
scrape
.
count
())
def
testCitation
(
self
):
scrape
=
Citeseer
.
CitationScraper
(
open
(
os
.
path
.
join
(
base
,
'citation.html'
))
.
read
())
citation
=
scrape
.
citation
()
self
.
failUnlessEqual
(
"I'm an abstract with white space !"
,
citation
[
'abstract'
])
bibtex
=
"""@misc{ sample,
author = "O. Babaoglu and H. Meling and A. Montresor"
}"""
self
.
failUnlessEqual
(
bibtex
,
citation
[
'bibtex'
])
Event Timeline
Log In to Comment