Spaces:
Sleeping
Sleeping
Download final/tests/test_cryptobert.py from joshworksit/bot: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/joshworksit/bot/resolve/main/final/tests/test_cryptobert.py
- Command line
-
hf download hf://spaces/joshworksit/bot/final/tests/test_cryptobert.py
-
curl -L -o test_cryptobert.py https://huggingface.co/spaces/joshworksit/bot/resolve/main/final/tests/test_cryptobert.py
1.4 kB
| import os | |
| import pytest | |
| from ai_models import ( | |
| analyze_crypto_sentiment, | |
| analyze_financial_sentiment, | |
| analyze_market_text, | |
| analyze_social_sentiment, | |
| registry_status, | |
| ) | |
| from config import get_settings | |
| settings = get_settings() | |
| pytestmark = pytest.mark.skipif( | |
| not os.getenv("HF_TOKEN") and not os.getenv("HF_TOKEN_ENCODED"), | |
| reason="HF token not configured", | |
| ) | |
| def test_crypto_sentiment_structure() -> None: | |
| result = analyze_crypto_sentiment("Bitcoin continues its bullish momentum") | |
| assert "label" in result | |
| assert "score" in result | |
| def test_multi_model_sentiments() -> None: | |
| financial = analyze_financial_sentiment("Equities rallied on strong earnings") | |
| social = analyze_social_sentiment("The community on twitter is excited about ETH") | |
| assert "label" in financial | |
| assert "label" in social | |
| def test_market_text_router() -> None: | |
| response = analyze_market_text("Summarize Bitcoin market sentiment today") | |
| assert "summary" in response | |
| assert "signals" in response | |
| assert "crypto" in response["signals"] | |