Spaces:
Sleeping
Sleeping
from flask import json | |
import pytest | |
from app import app | |
from baseline import create_baseline_pipeline | |
def client(): | |
app.config["DEBUG"] = True | |
app.config["TESTING"] = True | |
app.baseline_pipeline = create_baseline_pipeline() | |
yield app.test_client() | |
def test_fix_commas_fails_on_no_parameter(client): | |
response = client.post('/baseline/fix-commas/') | |
assert response.status_code == 400 | |
def test_fix_commas_fails_on_wrong_parameters(client): | |
response = client.post('/baseline/fix-commas/', json={'text': "Some text."}) | |
assert response.status_code == 400 | |
def test_fix_commas_plain_string_unchanged(client, test_input: str): | |
response = client.post('/baseline/fix-commas/', json={'s': test_input}) | |
assert response.status_code == 200 | |
assert response.get_json().get('s') == test_input | |
def test_fix_commas_fixes_wrong_commas(client, test_input: str, expected: str): | |
response = client.post('/baseline/fix-commas/', json={'s': test_input}) | |
assert response.status_code == 200 | |
assert response.get_json().get('s') == expected | |