Skip to content

Commit 018689a

Browse files
jeremymanningclaude
andcommitted
Move scattered test files to tests/ directory
Moves test files from demo directories to centralized tests/ folder: - demos/15-chatbot-evolution/test-*.{js,mjs} -> tests/test-demo15-*.{js,mjs} - demos/15-chatbot-evolution/js/test-parry-runner.js -> tests/test-demo15-parry-runner.js - demos/11-analogies/data/test_*.py -> tests/test-demo11-*.py Updates all import paths to reference demo files from new location: - JS imports: ./js/* -> ../demos/15-chatbot-evolution/js/* - Python paths: uses os.path for reliable path resolution All moved tests verified working from new location. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 9d77307 commit 018689a

8 files changed

+28
-10
lines changed

demos/11-analogies/data/test_embeddings.py renamed to tests/test-demo11-embeddings.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66

77
import json
88
import sys
9+
import os
910

10-
def test_embeddings(json_file='glove-50d.json'):
11+
# Get the directory of this script to resolve relative paths
12+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
13+
DATA_DIR = os.path.join(SCRIPT_DIR, '..', 'demos', '11-analogies', 'data')
14+
DEFAULT_JSON = os.path.join(DATA_DIR, 'glove-50d.json')
15+
16+
def test_embeddings(json_file=None):
1117
"""Test the embeddings JSON file."""
18+
if json_file is None:
19+
json_file = DEFAULT_JSON
1220
print(f"Testing {json_file}...")
1321
print("=" * 60)
1422

@@ -97,6 +105,6 @@ def test_embeddings(json_file='glove-50d.json'):
97105
return True
98106

99107
if __name__ == "__main__":
100-
json_file = sys.argv[1] if len(sys.argv) > 1 else 'glove-50d.json'
108+
json_file = sys.argv[1] if len(sys.argv) > 1 else None
101109
success = test_embeddings(json_file)
102110
sys.exit(0 if success else 1)

demos/11-analogies/data/test_demo_integration.py renamed to tests/test-demo11-integration.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
import json
88
import math
9+
import os
10+
11+
# Get the directory of this script to resolve relative paths
12+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
13+
DATA_DIR = os.path.join(SCRIPT_DIR, '..', 'demos', '11-analogies', 'data')
914

1015
def cosine_similarity(v1, v2):
1116
"""Compute cosine similarity between two vectors."""
@@ -54,7 +59,7 @@ def test_demo_integration():
5459

5560
# Load embeddings
5661
print("\n1. Loading embeddings...")
57-
with open('glove-50d.json', 'r') as f:
62+
with open(os.path.join(DATA_DIR, 'glove-50d.json'), 'r') as f:
5863
embeddings = json.load(f)
5964
print(f" ✓ Loaded {len(embeddings):,} word embeddings")
6065

File renamed without changes.

demos/15-chatbot-evolution/test-alice-full-automated.mjs renamed to tests/test-demo15-alice-full-automated.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { AliceFull } from './js/alice-full.js';
2-
import { Alice } from './js/alice.js';
1+
import { AliceFull } from '../demos/15-chatbot-evolution/js/alice-full.js';
2+
import { Alice } from '../demos/15-chatbot-evolution/js/alice.js';
33
import { readFileSync } from 'fs';
4+
import { fileURLToPath } from 'url';
5+
import { dirname, join } from 'path';
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = dirname(__filename);
49

510
console.log('='.repeat(80));
611
console.log('ALICE FULL - COMPREHENSIVE AUTOMATED TESTING SUITE');
@@ -47,7 +52,7 @@ function reportWarning(testName, message, details = '') {
4752
// Load patterns (Node.js version - load from file system)
4853
console.log('Loading ALICE Full patterns...');
4954
try {
50-
const patternsData = JSON.parse(readFileSync('./data/alice-patterns-full.json', 'utf-8'));
55+
const patternsData = JSON.parse(readFileSync(join(__dirname, '../demos/15-chatbot-evolution/data/alice-patterns-full.json'), 'utf-8'));
5156
console.log(`Source: ${patternsData.metadata.source}`);
5257
console.log(`Total patterns: ${patternsData.metadata.total_patterns}`);
5358
console.log(`Files: ${patternsData.metadata.files_processed}`);

demos/15-chatbot-evolution/test-clamping-bug.mjs renamed to tests/test-demo15-clamping-bug.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Parry } from './js/parry.js';
1+
import { Parry } from '../demos/15-chatbot-evolution/js/parry.js';
22

33
console.log('='.repeat(70));
44
console.log('DETAILED ANALYSIS: EMOTION CLAMPING BUG');

demos/15-chatbot-evolution/test-emotional-state-examples.mjs renamed to tests/test-demo15-emotional-state-examples.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Parry } from './js/parry.js';
1+
import { Parry } from '../demos/15-chatbot-evolution/js/parry.js';
22

33
console.log('='.repeat(80));
44
console.log('PARRY EMOTIONAL STATE ISSUES - DETAILED CONVERSATION EXAMPLES');

demos/15-chatbot-evolution/test-parry-cli.mjs renamed to tests/test-demo15-parry-cli.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Parry } from './js/parry.js';
1+
import { Parry } from '../demos/15-chatbot-evolution/js/parry.js';
22

33
// Test results tracking
44
const results = {

demos/15-chatbot-evolution/js/test-parry-runner.js renamed to tests/test-demo15-parry-runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Parry } from './parry.js';
1+
import { Parry } from '../demos/15-chatbot-evolution/js/parry.js';
22

33
// Test results tracking
44
const results = {

0 commit comments

Comments
 (0)