37 lines
1020 B
Python
37 lines
1020 B
Python
#!/usr/bin/env python3
|
|
"""Simple test to verify basic functionality"""
|
|
|
|
import sqlite3
|
|
import os
|
|
|
|
# Clean up any existing database
|
|
if os.path.exists('jokes.db'):
|
|
os.remove('jokes.db')
|
|
print("Cleaned existing database")
|
|
|
|
# Test importing and initializing
|
|
try:
|
|
from jokes import initialize_database
|
|
print("✓ Successfully imported jokes module")
|
|
|
|
initialize_database()
|
|
print("✓ Database initialized successfully")
|
|
|
|
# Test database connection
|
|
db = sqlite3.connect('jokes.db')
|
|
cursor = db.execute("SELECT COUNT(*) FROM jokes")
|
|
count = cursor.fetchone()[0]
|
|
print(f"✓ Found {count} jokes in database")
|
|
|
|
# Test user_sentiments table structure
|
|
cursor = db.execute("PRAGMA table_info(user_sentiments)")
|
|
columns = cursor.fetchall()
|
|
print("✓ user_sentiments table columns:")
|
|
for col in columns:
|
|
print(f" - {col[1]} ({col[2]})")
|
|
|
|
db.close()
|
|
print("✓ All tests passed!")
|
|
|
|
except Exception as e:
|
|
print(f"✗ Error: {e}") |