Skip to content

Commit 2ff117d

Browse files
authored
fix: update CI pipeline (#127)
* fix: update CI pipeline * fix: update syntax * fix: unit tests * fix: redirection test * fix: https -> http in redirection test
1 parent 6ee9ce9 commit 2ff117d

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest]
2020
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
21-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] # "3.14-dev"
21+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2222
include:
2323
# other OS version necessary
2424
- os: macos-latest
25-
python-version: "3.12"
25+
python-version: "3.13"
2626
- os: windows-latest
27-
python-version: "3.12"
27+
python-version: "3.13"
2828
steps:
2929
- uses: actions/checkout@v4
3030

courlan/urlstore.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
class Compressor:
5555
"Use system information on available compression modules and define corresponding methods."
56+
5657
__slots__ = ("compressor", "decompressor")
5758

5859
def __init__(self, compression: bool = True) -> None:
@@ -86,13 +87,15 @@ def decompress(self, data: bytes) -> Any:
8687

8788
class State(Enum):
8889
"Record state information about a domain or host."
90+
8991
OPEN = 1
9092
ALL_VISITED = 2
9193
BUSTED = 3
9294

9395

9496
class DomainEntry:
9597
"Class to record host-related information and URL paths."
98+
9699
__slots__ = ("count", "rules", "state", "timestamp", "total", "tuples")
97100

98101
def __init__(self, state: State = State.OPEN) -> None:
@@ -106,6 +109,7 @@ def __init__(self, state: State = State.OPEN) -> None:
106109

107110
class UrlPathTuple:
108111
"Class storing information for URL paths relative to a domain/host."
112+
109113
__slots__ = ("urlpath", "visited")
110114

111115
def __init__(self, urlpath: str, visited: bool) -> None:
@@ -119,6 +123,7 @@ def path(self) -> str:
119123

120124
class UrlStore:
121125
"Defines a class to store domain-classified URLs and perform checks against it."
126+
122127
__slots__ = (
123128
"compressed",
124129
"done",

tests/unit_tests.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,11 @@ def test_domain_filter():
750750

751751
def test_urlcheck_redirects():
752752
"Test redirection checks."
753-
assert check_url("https://www.httpbun.com/status/200", with_redirects=True) == (
754-
"https://httpbun.com",
755-
"httpbun.com",
753+
assert check_url("https://httpbun.org/redirect-to?url=http%3A%2F%2Fexample.org", with_redirects=True) == (
754+
"http://example.org",
755+
"example.org",
756756
)
757-
assert check_url("https://www.httpbin.org/status/404", with_redirects=True) is None
757+
assert check_url("https://httpbun.org/status/404", with_redirects=True) is None
758758
assert check_url("https://www.ht.or", with_redirects=True) is None
759759

760760

@@ -764,11 +764,11 @@ def test_urlutils():
764764
assert extract_domain("") is None
765765
assert extract_domain(5) is None
766766
assert extract_domain("h") is None
767-
assert extract_domain("https://httpbin.org/") == "httpbin.org"
768-
assert extract_domain("https://www.httpbin.org/", fast=True) == "httpbin.org"
767+
assert extract_domain("https://httpbun.org/") == "httpbun.org"
768+
assert extract_domain("https://www.httpbun.org/", fast=True) == "httpbun.org"
769769
assert extract_domain("http://www.mkyong.com.au", fast=True) == "mkyong.com.au"
770770
assert extract_domain("http://mkyong.t.t.co", fast=True) == "mkyong.t.t.co"
771-
assert extract_domain("ftp://www4.httpbin.org", fast=True) == "httpbin.org"
771+
assert extract_domain("ftp://www4.httpbun.org", fast=True) == "httpbun.org"
772772
assert extract_domain("http://w3.example.com", fast=True) == "example.com"
773773
assert extract_domain("https://de.nachrichten.yahoo.com/", fast=True) == "yahoo.com"
774774
assert (
@@ -787,7 +787,7 @@ def test_urlutils():
787787
assert extract_domain("http://example.com?query=one", fast=True) == "example.com"
788788
assert extract_domain("http://example.com#fragment", fast=True) == "example.com"
789789
# url parsing
790-
result = _parse("https://httpbin.org/")
790+
result = _parse("https://httpbun.org/")
791791
assert isinstance(result, SplitResult)
792792
newresult = _parse(result)
793793
assert isinstance(result, SplitResult)
@@ -803,9 +803,9 @@ def test_urlutils():
803803
)
804804
assert get_host_and_path("https://example.org/") == ("https://example.org", "/")
805805
assert get_host_and_path("https://example.org") == ("https://example.org", "/")
806-
assert get_hostinfo("https://httpbin.org/") == (
807-
"httpbin.org",
808-
"https://httpbin.org",
806+
assert get_hostinfo("https://httpbun.org/") == (
807+
"httpbun.org",
808+
"https://httpbun.org",
809809
)
810810
assert get_hostinfo("https://example.org/path") == (
811811
"example.org",
@@ -928,29 +928,29 @@ def test_extraction():
928928
# navigation
929929
pagecontent = "<html><head><title>Links</title></head><body><a href='/links/2/0'>0</a> <a href='/links/2/1'>1</a> </body></html>"
930930
links = extract_links(
931-
pagecontent, "https://httpbin.org", external_bool=False, with_nav=True
931+
pagecontent, "https://httpbun.org", external_bool=False, with_nav=True
932932
)
933933
assert sorted(links) == [
934-
"https://httpbin.org/links/2/0",
935-
"https://httpbin.org/links/2/1",
934+
"https://httpbun.org/links/2/0",
935+
"https://httpbun.org/links/2/1",
936936
]
937937
links = extract_links(
938-
pagecontent, url="https://httpbin.org", external_bool=False, with_nav=True
938+
pagecontent, url="https://httpbun.org", external_bool=False, with_nav=True
939939
)
940940
assert sorted(links) == [
941-
"https://httpbin.org/links/2/0",
942-
"https://httpbin.org/links/2/1",
941+
"https://httpbun.org/links/2/0",
942+
"https://httpbun.org/links/2/1",
943943
]
944944
pagecontent = "<html><head><title>Links</title></head><body><a href='links/2/0'>0</a> <a href='links/2/1'>1</a> </body></html>"
945945
links = extract_links(
946946
pagecontent,
947-
url="https://httpbin.org/page1/",
947+
url="https://httpbun.org/page1/",
948948
external_bool=False,
949949
with_nav=True,
950950
)
951951
assert sorted(links) == [
952-
"https://httpbin.org/page1/links/2/0",
953-
"https://httpbin.org/page1/links/2/1",
952+
"https://httpbun.org/page1/links/2/0",
953+
"https://httpbun.org/page1/links/2/1",
954954
]
955955
pagecontent = "<html><head><title>Pages</title></head><body><a href='/page/10'>10</a> <a href='/page/?=11'>11</a></body></html>"
956956
assert (
@@ -1186,8 +1186,8 @@ def test_examples():
11861186
"test.net",
11871187
)
11881188
assert check_url(
1189-
"https://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.org", strict=True
1190-
) == ("https://httpbin.org/redirect-to", "httpbin.org")
1189+
"https://httpbun.org/redirect-to?url=http%3A%2F%2Fexample.org", strict=True
1190+
) == ("https://httpbun.org/redirect-to", "httpbun.org")
11911191
assert clean_url("HTTPS://WWW.DWDS.DE:80/") == "https://www.dwds.de"
11921192
assert validate_url("http://1234") == (False, None)
11931193
assert validate_url("http://www.example.org/")[0] is True

0 commit comments

Comments
 (0)