/
Euphonium
/
SE_FastAPI_Example
Обзор
Документация
Войти
/
Euphonium
/
SE_FastAPI_Example
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
main
tests/conftest.py
38 строк
940 B
Ivanov Maxim
Add tests for FastAPI endpoints and models
13 май 2026, 12:16
13 май 2026, 12:16
e44c0da
Код
Авторство
О чём код?
import os import sys from pathlib import Path from typing import Generator import pytest sys.path.insert(0, str(Path(__file__).parent.parent / "fastapi")) sys.path.insert(0, str(Path(__file__).parent.parent / "streamlit")) @pytest.fixture def sample_texts(): return { "positive": "I love this amazing product! It's fantastic!", "negative": "This is terrible and disappointing. Very bad.", "neutral": "The table is made of wood.", "empty": "", "long": "This is a test. " * 100, } @pytest.fixture def fastapi_app(): try: from fastapi.main import app return app except ImportError: pytest.skip("FastAPI application not available") @pytest.fixture def test_client(fastapi_app): try: from fastapi.testclient import TestClient return TestClient(fastapi_app) except ImportError: pytest.skip("FastAPI test client not available")