sahilfarib's picture
Upload folder using huggingface_hub
db3715a verified
Raw
History Blame Contribute Delete
4.69 kB
"""
tests/conftest.py — Shared pytest fixtures
Provides reusable fixtures for testing ingestion and retrieval layers.
Uses temporary directories to isolate test data.
"""
import sys
import os
import tempfile
from pathlib import Path
import pytest
# Ensure project root is in sys.path
PROJECT_ROOT = Path(__file__).parent.parent
sys.path.insert(0, str(PROJECT_ROOT))
@pytest.fixture
def sample_legal_text():
"""A realistic legal contract text for testing."""
return """
SERVICE AGREEMENT
This Service Agreement ("Agreement") is entered into as of January 15, 2024,
by and between TechCorp Solutions Inc., a Delaware corporation ("Provider"),
and Greenfield Properties LLC, a New York limited liability company ("Client").
WHEREAS, Provider offers technology consulting services; and
WHEREAS, Client desires to engage Provider for such services;
NOW, THEREFORE, the parties agree as follows:
1. SCOPE OF SERVICES
Provider shall deliver cloud migration consulting services as described in
Exhibit A attached hereto. Services shall commence on February 1, 2024 and
continue for a period of twelve (12) months ("Term").
2. COMPENSATION
Client shall pay Provider a monthly fee of $25,000.00 (Twenty-Five Thousand
Dollars), due on the first business day of each month. Late payments shall
accrue interest at 1.5% per month.
3. CONFIDENTIALITY
Both parties agree to maintain strict confidentiality of all proprietary
information shared during the engagement. This obligation survives termination
of this Agreement for a period of three (3) years.
4. LIMITATION OF LIABILITY
In no event shall Provider's total liability exceed the fees paid by Client
during the six (6) months preceding the claim. Provider shall not be liable
for indirect, consequential, or punitive damages.
5. TERMINATION
Either party may terminate this Agreement with sixty (60) days written notice.
In the event of material breach, the non-breaching party may terminate
immediately upon written notice.
6. GOVERNING LAW
This Agreement shall be governed by the laws of the State of New York.
IN WITNESS WHEREOF, the parties have executed this Agreement as of the date
first written above.
TechCorp Solutions Inc.
By: ________________________
Name: John Smith, CEO
Greenfield Properties LLC
By: ________________________
Name: Sarah Johnson, Managing Partner
"""
@pytest.fixture
def sample_litigation_memo():
"""A realistic litigation memo text for testing."""
return """
PRIVILEGED AND CONFIDENTIAL
ATTORNEY WORK PRODUCT
INTERNAL MEMORANDUM
TO: Harvey Specter, Senior Partner
FROM: Mike Ross, Associate
DATE: March 10, 2024
RE: Greenfield Properties v. TechCorp Solutions — Case No. 2024-CV-3847
I. SUMMARY
This memo addresses the breach of contract claim filed by Greenfield Properties
LLC against TechCorp Solutions Inc. relating to the cloud migration consulting
agreement dated January 15, 2024.
II. FACTUAL BACKGROUND
On January 15, 2024, Greenfield Properties entered into a Service Agreement
with TechCorp for cloud migration consulting services at a monthly rate of
$25,000. TechCorp commenced work on February 1, 2024 as scheduled.
However, beginning in April 2024, TechCorp failed to meet several critical
milestones outlined in Exhibit A. Specifically:
- Database migration was 45 days behind schedule
- Security audit deliverable was never completed
- Two senior consultants assigned to the project were reassigned without notice
III. LEGAL ANALYSIS
The Service Agreement contains a limitation of liability clause (Section 4)
capping damages at six months of fees ($150,000). However, there are grounds
to argue this clause is unconscionable given:
1. The parties had unequal bargaining power
2. The clause was presented on a take-it-or-leave-it basis
3. Client was not represented by counsel at signing
RED FLAGS:
- The limitation clause may not cover willful misconduct
- TechCorp's reassignment of consultants may constitute material breach
- Missing security audit creates potential regulatory exposure
IV. RECOMMENDATION
File motion to invalidate the limitation of liability clause. Seek damages
in the amount of $450,000 representing actual losses from delayed migration
plus regulatory penalties.
"""
@pytest.fixture
def temp_dir():
"""Provide a temporary directory for test artifacts."""
with tempfile.TemporaryDirectory() as tmpdir:
yield Path(tmpdir)
@pytest.fixture
def sample_pdf_path(temp_dir, sample_legal_text):
"""Create a simple text file simulating a PDF (for unit tests that don't need real PDF)."""
path = temp_dir / "test_contract.txt"
path.write_text(sample_legal_text, encoding="utf-8")
return str(path)