-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_social_media_extractions.py
More file actions
71 lines (64 loc) · 2.74 KB
/
test_social_media_extractions.py
File metadata and controls
71 lines (64 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import pytest
from src.models.europython import EuroPythonSpeaker
@pytest.mark.parametrize(
("input_string", "result"),
[
("http://mastodon.social/@username", "https://mastodon.social/@username"),
("https://mastodon.social/@username", "https://mastodon.social/@username"),
(
"https://mastodon.social/@username?something=true",
"https://mastodon.social/@username",
),
("@username@mastodon.social", "https://mastodon.social/@username"),
("username@mastodon.social", "https://mastodon.social/@username"),
],
)
def test_extract_mastodon_url(input_string: str, result: str) -> None:
assert EuroPythonSpeaker.extract_mastodon_url(input_string) == result
@pytest.mark.parametrize(
("input_string", "result"),
[
("username", "https://linkedin.com/in/username"),
("linkedin.com/in/username", "https://linkedin.com/in/username"),
("in/username", "https://linkedin.com/in/username"),
("www.linkedin.com/in/username", "https://www.linkedin.com/in/username"),
("http://linkedin.com/in/username", "https://linkedin.com/in/username"),
("https://linkedin.com/in/username", "https://linkedin.com/in/username"),
],
)
def test_extract_linkedin_url(input_string: str, result: str) -> None:
assert EuroPythonSpeaker.extract_linkedin_url(input_string) == result
@pytest.mark.parametrize(
("input_string", "result"),
[
("username", "https://bsky.app/profile/username.bsky.social"),
("@username", "https://bsky.app/profile/username.bsky.social"),
("username.dev", "https://bsky.app/profile/username.dev"),
("@username.dev", "https://bsky.app/profile/username.dev"),
("username.bsky.social", "https://bsky.app/profile/username.bsky.social"),
("bsky.app/profile/username", "https://bsky.app/profile/username.bsky.social"),
("bsky/username", "https://bsky.app/profile/username.bsky.social"),
(
"www.bsky.app/profile/username",
"https://bsky.app/profile/username.bsky.social",
),
(
"www.bsky.app/profile/username.bsky.social",
"https://bsky.app/profile/username.bsky.social",
),
(
"http://bsky.app/profile/username",
"https://bsky.app/profile/username.bsky.social",
),
(
"https://bsky.app/profile/username.com",
"https://bsky.app/profile/username.com",
),
(
"https://bsky.app/profile/username.bsky.social",
"https://bsky.app/profile/username.bsky.social",
),
],
)
def test_extract_bluesky_url(input_string: str, result: str) -> None:
assert EuroPythonSpeaker.extract_bluesky_url(input_string) == result