25 lines
911 B
Python
25 lines
911 B
Python
import sys, os
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
|
from scraper import extract_hashtags, extract_mentions, profile_slug_from_url
|
|
|
|
def test_extract_hashtags_basic():
|
|
assert extract_hashtags("Hello #world #foo") == ["#world", "#foo"]
|
|
|
|
def test_extract_hashtags_empty():
|
|
assert extract_hashtags("No tags here") == []
|
|
|
|
def test_extract_hashtags_deduplicates():
|
|
assert extract_hashtags("#foo #foo #bar") == ["#foo", "#bar"]
|
|
|
|
def test_extract_mentions_basic():
|
|
assert extract_mentions("Hey @alice and @bob") == ["@alice", "@bob"]
|
|
|
|
def test_extract_mentions_empty():
|
|
assert extract_mentions("No mentions") == []
|
|
|
|
def test_profile_slug_from_url():
|
|
assert profile_slug_from_url("https://www.instagram.com/licmuunisul/") == "licmuunisul"
|
|
|
|
def test_profile_slug_trailing_slash():
|
|
assert profile_slug_from_url("https://www.instagram.com/licmuunisul") == "licmuunisul"
|