test_simple.py
import unittest import os import tempfile import shutil import json import pandas as pd import numpy as np
class TestBasicFunctionality(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.test_dir)
def test_file_creation(self):
"""Test basic file creation and reading"""
# Create a test JSON file
test_data = {"test_accuracy": 0.85, "f1_score": 0.82}
test_file = os.path.join(self.test_dir, "test.json")
with open(test_file, 'w') as f:
json.dump(test_data, f)
# Read it back
with open(test_file, 'r') as f:
loaded_data = json.load(f)
self.assertEqual(loaded_data["test_accuracy"], 0.85)
self.assertEqual(loaded_data["f1_score"], 0.82)
def test_dataframe_creation(self):
"""Test DataFrame functionality"""
data = {
'epoch': [1, 2, 3],
'accuracy': [0.1, 0.2, 0.3],
'val_accuracy': [0.08, 0.18, 0.28]
}
df = pd.DataFrame(data)
self.assertEqual(len(df), 3)
self.assertIn('accuracy', df.columns)
if name == 'main': unittest.main()
Log in or sign up for Devpost to join the conversation.