diff --git a/modules/00_setup/tests/test_setup.py b/modules/00_setup/tests/test_setup.py index 00e91a40..6f449d08 100644 --- a/modules/00_setup/tests/test_setup.py +++ b/modules/00_setup/tests/test_setup.py @@ -1,18 +1,15 @@ -#!/usr/bin/env python3 """ -Tests for the setup module using pytest. +Test suite for the setup module. +This tests the student implementations to ensure they work correctly. """ import pytest +import numpy as np import sys import os -from pathlib import Path -from io import StringIO -# Add the parent directory to the path so we can import setup_dev -sys.path.insert(0, str(Path(__file__).parent.parent)) - -from setup_dev import hello_tinytorch, add_numbers, SystemInfo, DeveloperProfile +# Import from the main package (rock solid foundation) +from tinytorch.core.utils import hello_tinytorch, add_numbers, SystemInfo, DeveloperProfile class TestSetupFunctions: diff --git a/modules/01_tensor/tests/test_tensor.py b/modules/01_tensor/tests/test_tensor.py index 7247af12..1b182af8 100644 --- a/modules/01_tensor/tests/test_tensor.py +++ b/modules/01_tensor/tests/test_tensor.py @@ -1,24 +1,15 @@ """ -Tests for TinyTorch Tensor module. - -Tests the core tensor functionality including creation, arithmetic operations, -utility methods, and edge cases. - -These tests work with the current implementation and provide stretch goals -for students to implement additional methods. +Test suite for the tensor module. +This tests the student implementations to ensure they work correctly. """ -import sys -import os import pytest import numpy as np +import sys +import os -# Add the parent directory to path to import tensor_dev -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -# Import from the module's development file -# Note: This imports the instructor version with full implementation -from tensor_dev import Tensor +# Import from the main package (rock solid foundation) +from tinytorch.core.tensor import Tensor def safe_numpy(tensor): """Get numpy array from tensor, using .numpy() if available, otherwise .data""" diff --git a/modules/02_activations/tests/test_activations.py b/modules/02_activations/tests/test_activations.py index e3acd01e..c7b5fbb4 100644 --- a/modules/02_activations/tests/test_activations.py +++ b/modules/02_activations/tests/test_activations.py @@ -10,10 +10,7 @@ import os # Import from the main package (rock solid foundation) from tinytorch.core.tensor import Tensor - -# Import our implementations from the local module for testing -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) -from activations_dev import ReLU, Sigmoid, Tanh, Softmax +from tinytorch.core.activations import ReLU, Sigmoid, Tanh, Softmax class TestReLU: diff --git a/modules/03_layers/tests/test_layers.py b/modules/03_layers/tests/test_layers.py index b3c75d57..e2597b8f 100644 --- a/modules/03_layers/tests/test_layers.py +++ b/modules/03_layers/tests/test_layers.py @@ -1,28 +1,17 @@ """ -Tests for TinyTorch Layers module. - -Tests the core layer functionality including Dense layers, activation functions, -and layer composition. - -These tests work with the current implementation and provide stretch goals -for students to implement additional features. +Test suite for the layers module. +This tests the student implementations to ensure they work correctly. """ -import sys -import os import pytest import numpy as np +import sys +import os -# Add the parent directory to path to import layers_dev -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -# Import from the module's development file -# Note: This imports the instructor version with full implementation -from layers_dev import Dense, Tensor - -# Import activation functions from the activations module -sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), '..', '02_activations')) -from activations_dev import ReLU, Sigmoid, Tanh +# Import from the main package (rock solid foundation) +from tinytorch.core.tensor import Tensor +from tinytorch.core.layers import Dense +from tinytorch.core.activations import ReLU, Sigmoid, Tanh def safe_numpy(tensor): """Get numpy array from tensor, using .numpy() if available, otherwise .data""" diff --git a/modules/05_dataloader/tests/test_dataloader.py b/modules/05_dataloader/tests/test_dataloader.py index acea106e..b449b063 100644 --- a/modules/05_dataloader/tests/test_dataloader.py +++ b/modules/05_dataloader/tests/test_dataloader.py @@ -1,29 +1,20 @@ """ -Tests for TinyTorch DataLoader module. - -Tests follow the "Build → Use → Understand" pattern: -1. Build Dataset → Test with local test data -2. Build DataLoader → Test batching test data -3. Build Normalizer → Test normalizing test data -4. Build Pipeline → Test complete test pipeline - -These tests work with small local test data for fast, reliable testing. +Test suite for the dataloader module. +This tests the student implementations to ensure they work correctly. """ -import sys -import os import pytest import numpy as np +import sys +import os import tempfile import shutil -import pickle from pathlib import Path +from unittest.mock import patch, MagicMock -# Add the parent directory to path to import dataloader_dev -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -# Import from the module's development file -from dataloader_dev import Dataset, DataLoader, CIFAR10Dataset, Normalizer, create_data_pipeline, Tensor +# Import from the main package (rock solid foundation) +from tinytorch.core.tensor import Tensor +from tinytorch.core.dataloader import Dataset, DataLoader, CIFAR10Dataset, Normalizer, create_data_pipeline def safe_numpy(tensor): """Get numpy array from tensor, using .data attribute"""