From fa94715cd237bf796e038bdea1d2eaa3bb4f2096 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 05:15:35 +0000 Subject: [PATCH] Initial upload with comprehensive README and tests --- tests/conftest.py | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e2d951d --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,96 @@ +"""Pytest configuration for json-to-openapi tests.""" +import pytest +import json +from pathlib import Path + + +@pytest.fixture +def sample_simple_json(): + return {"name": "John", "age": 30, "active": True} + + +@pytest.fixture +def sample_nested_json(): + return { + "id": 1, + "name": "Product", + "price": 29.99, + "in_stock": True, + "tags": ["electronics", "sale"], + "metadata": { + "created_at": "2024-01-15", + "updated_at": "2024-01-20" + } + } + + +@pytest.fixture +def sample_array_json(): + return [ + {"id": 1, "name": "Item 1"}, + {"id": 2, "name": "Item 2"}, + {"id": 3, "name": "Item 3"} + ] + + +@pytest.fixture +def sample_complex_json(tmp_path): + data = { + "users": [ + { + "id": 1, + "name": "Alice", + "email": "alice@example.com", + "active": True, + "scores": [95, 87, 92], + "address": { + "street": "123 Main St", + "city": "Boston", + "zip": "02101" + } + }, + { + "id": 2, + "name": "Bob", + "email": "bob@example.com", + "active": False, + "scores": [78, 85, 80], + "address": { + "street": "456 Oak Ave", + "city": "Cambridge", + "zip": "02139" + } + } + ], + "total": 2 + } + file_path = tmp_path / "complex.json" + file_path.write_text(json.dumps(data)) + return file_path + + +@pytest.fixture +def sample_datetime_json(tmp_path): + data = { + "created_at": "2024-01-15T10:30:00Z", + "updated_at": "2024-01-20T14:45:30", + "event_date": "2024-03-01" + } + file_path = tmp_path / "datetime.json" + file_path.write_text(json.dumps(data)) + return file_path + + +@pytest.fixture +def temp_json_dir(tmp_path): + """Create a temporary directory with sample JSON files.""" + dir_path = tmp_path / "json_files" + dir_path.mkdir() + + simple = dir_path / "simple.json" + simple.write_text('{"name": "Test", "value": 42}') + + nested = dir_path / "nested.json" + nested.write_text('{"data": {"items": [1, 2, 3]}}') + + return dir_path