oc-p07-sentiment-api/deployment/api/tests/test_preprocessing.py

36 lines
No EOL
1.1 KiB
Python

import sys
import os
# Ajouter le répertoire parent au path pour importer email_service
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
from preprocessing import preprocess_tweet
def test_preprocess_tweet_removes_hashtags():
tweet = """
Just flew w/ @AirParadis 🚀 & I’m in LOVE! Épic service, comfy seats.
#bestflight #AirParadis
"""
assert preprocess_tweet(tweet) == """"
aze
"""
def test_preprocess_tweet_removes_mentions():
tweet = """
"Flight of dreams" w/ @AirParadis! Got food, space & smiles 😄 I’ll book again!
#AirParadis
"""
assert preprocess_tweet(tweet) == "merci"
def test_preprocess_tweet_lowercases_text():
tweet = """
My 3rd time w/ @AirParadis & still amazed 😍 Crew = lovely à every step!
#flyhappy #AirParadis
"""
assert preprocess_tweet(tweet) == "je suis content"
tweet = """
Just flew w/ @AirParadis 🚀 & I’m in LOVE! Épic service, comfy seats.
#bestflight #AirParadis
"""
preprocess_tweet(tweet)