Skip to content

Commit 8df2d0d

Browse files
committed
Add test status badge
1 parent 4f67c29 commit 8df2d0d

File tree

3 files changed

+51
-30
lines changed

3 files changed

+51
-30
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# waybackprov
22

3+
[![Test](https://github.com/DocNow/waybackprov/actions/workflows/test.yml/badge.svg)](https://github.com/DocNow/waybackprov/actions/workflows/test.yml)
4+
35
Give *waybackprov* a URL and it will summarize which Internet Archive
46
collections have archived the URL. This kind of information can sometimes
57
provide insight about why a particular web resource or set of web resources were

setup.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
if __name__ == "__main__":
77
setup(
8-
name='waybackprov',
9-
version='0.0.9',
10-
url='https://github.com/edsu/waybackprov',
11-
author='Ed Summers',
12-
author_email='ehs@pobox.com',
13-
py_modules=['waybackprov', ],
14-
description='Checks the provenance of a URL in the Wayback machine',
8+
name="waybackprov",
9+
version="0.0.9",
10+
url="https://github.com/edsu/waybackprov",
11+
author="Ed Summers",
12+
author_email="ehs@pobox.com",
13+
py_modules=[
14+
"waybackprov",
15+
],
16+
description="Checks the provenance of a URL in the Wayback machine",
1517
long_description=long_description,
1618
long_description_content_type="text/markdown",
17-
python_requires='>=3.0',
18-
entry_points={'console_scripts': ['waybackprov = waybackprov:main']}
19+
python_requires=">=3.0",
20+
entry_points={"console_scripts": ["waybackprov = waybackprov:main"]},
1921
)

test_waybackprov.py

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
11
from waybackprov import get_collection, get_crawls, get_depth, deepest_collection, cdx
22

3+
34
def test_coll():
4-
coll = get_collection('ArchiveIt-Collection-2410')
5-
assert coll['title'] == 'University of Maryland'
5+
coll = get_collection("ArchiveIt-Collection-2410")
6+
assert coll["title"] == "University of Maryland"
7+
68

79
def test_get_crawls():
8-
crawls = list(get_crawls('https://mith.umd.edu'))
10+
crawls = list(get_crawls("https://mith.umd.edu"))
911
assert len(crawls) > 0
10-
assert crawls[0]['timestamp']
11-
assert crawls[0]['url']
12-
assert crawls[0]['status']
13-
assert crawls[0]['collections']
14-
assert len(crawls[0]['collections']) > 0
12+
assert crawls[0]["timestamp"]
13+
assert crawls[0]["url"]
14+
assert crawls[0]["status"]
15+
assert crawls[0]["collections"]
16+
assert len(crawls[0]["collections"]) > 0
17+
1518

1619
def test_depth():
17-
assert get_depth('ArchiveIt-Collection-2410') == 4
18-
assert get_depth('wikipediaoutlinks00003') == 3
20+
assert get_depth("ArchiveIt-Collection-2410") == 4
21+
assert get_depth("wikipediaoutlinks00003") == 3
22+
1923

2024
def test_deepest_collection():
2125
colls = [
22-
'ArchiveIt-Partner-408',
23-
'archiveitdigitalcollection',
24-
'web',
25-
'archiveitpartners',
26-
'ArchiveIt-Collection-2410'
26+
"ArchiveIt-Partner-408",
27+
"archiveitdigitalcollection",
28+
"web",
29+
"archiveitpartners",
30+
"ArchiveIt-Collection-2410",
2731
]
28-
assert deepest_collection(colls) == 'ArchiveIt-Collection-2410'
32+
assert deepest_collection(colls) == "ArchiveIt-Collection-2410"
33+
2934

3035
def test_loop():
3136
# weirdly, some collections can contain themselves when there is a loop
3237
# e.g. coll1 ∃ coll2 and coll2 ∃ coll1
33-
assert get_depth('ArchiveIt-Partner-1140') == 3
38+
assert get_depth("ArchiveIt-Partner-1140") == 3
39+
3440

3541
def test_prefix():
36-
crawls = get_crawls('https://twitter.com/Guccifer_2', prefix=True, match='/status/\d+$')
42+
crawls = get_crawls(
43+
"https://twitter.com/Guccifer_2", prefix=True, match="/status/\d+$"
44+
)
3745
crawl = next(crawls)
38-
assert crawl['url']
46+
assert crawl["url"]
47+
3948

4049
def test_cdx():
41-
urls = cdx('https://twitter.com/Guccifer_2', match='/status/\d+$', start_year=2016, end_year=2018)
50+
urls = cdx(
51+
"https://twitter.com/Guccifer_2",
52+
match="/status/\d+$",
53+
start_year=2016,
54+
end_year=2018,
55+
)
4256
assert len(list(urls)) == 132
4357

58+
4459
def test_missing():
45-
crawls = list(get_crawls('https://twitter.com/slavresistance/status/1016697918970105857/'))
60+
crawls = list(
61+
get_crawls("https://twitter.com/slavresistance/status/1016697918970105857/")
62+
)
4663
assert len(crawls) == 0

0 commit comments

Comments
 (0)