Fix 01_setup: Correct pattern - Tests → STANDARDIZED MODULE TESTING → Module Summary

CORRECT PATTERN NOW:
1.  Unit tests (test_unit_personal_info_basic, test_unit_system_info_basic)
2.  ## 🧪 Module Testing
3.  STANDARDIZED MODULE TESTING cell
4.  run_module_tests_auto call
5.  ## 🎯 Module Summary (immediately after, no code between)

 Removed duplicate test functions that were incorrectly placed after run_module_tests_auto
 Clean separation: Tests → Testing → Summary
 No code between STANDARDIZED MODULE TESTING and Module Summary
This commit is contained in:
Vijay Janapa Reddi
2025-07-20 09:24:01 -04:00
parent 487c6fa050
commit 0355e0a44b

View File

@@ -545,75 +545,6 @@ if __name__ == "__main__":
# Automatically discover and run all tests in this module
success = run_module_tests_auto("Setup")
# %%
def test_unit_personal_info_basic():
"""Test personal_info function implementation."""
print("🔬 Unit Test: Personal Information...")
# Test personal_info function
personal = personal_info()
# Test return type
assert isinstance(personal, dict), "personal_info should return a dictionary"
# Test required keys
required_keys = ['developer', 'email', 'institution', 'system_name', 'version']
for key in required_keys:
assert key in personal, f"Dictionary should have '{key}' key"
# Test non-empty values
for key, value in personal.items():
assert isinstance(value, str), f"Value for '{key}' should be a string"
assert len(value) > 0, f"Value for '{key}' cannot be empty"
# Test email format
assert '@' in personal['email'], "Email should contain @ symbol"
assert '.' in personal['email'], "Email should contain domain"
# Test version format
assert personal['version'] == '1.0.0', "Version should be '1.0.0'"
# Test system name (should be unique/personalized)
assert len(personal['system_name']) > 5, "System name should be descriptive"
print("✅ Personal info function tests passed!")
print(f"✅ TinyTorch configured for: {personal['developer']}")
# %%
def test_unit_system_info_basic():
"""Test system_info function implementation."""
print("🔬 Unit Test: System Information...")
# Test system_info function
sys_info = system_info()
# Test return type
assert isinstance(sys_info, dict), "system_info should return a dictionary"
# Test required keys
required_keys = ['python_version', 'platform', 'architecture', 'cpu_count', 'memory_gb']
for key in required_keys:
assert key in sys_info, f"Dictionary should have '{key}' key"
# Test data types
assert isinstance(sys_info['python_version'], str), "python_version should be string"
assert isinstance(sys_info['platform'], str), "platform should be string"
assert isinstance(sys_info['architecture'], str), "architecture should be string"
assert isinstance(sys_info['cpu_count'], int), "cpu_count should be integer"
assert isinstance(sys_info['memory_gb'], (int, float)), "memory_gb should be number"
# Test reasonable values
assert sys_info['cpu_count'] > 0, "CPU count should be positive"
assert sys_info['memory_gb'] > 0, "Memory should be positive"
assert len(sys_info['python_version']) > 0, "Python version should not be empty"
# Test that values are actually queried (not hardcoded)
actual_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
assert sys_info['python_version'] == actual_version, "Python version should match actual system"
print("✅ System info function tests passed!")
print(f"✅ Python: {sys_info['python_version']} on {sys_info['platform']}")
# %% [markdown]
"""
## 🎯 Professional ML Engineering Skills