diff --git a/simulasyon_11.py b/simulasyon_11.py index 91852c1f..0b4566dc 100644 --- a/simulasyon_11.py +++ b/simulasyon_11.py @@ -2,17 +2,9 @@ import datetime import time import sys -import pandas as pd -import numpy as np import random -from scipy import stats from datetime import timedelta, date -# ============================================================================== -# SIMULE3: V.135 - OMEGA VERIFICATION ARCHIVE (PROVEN FULL VERSION) -# STATUS: NameError Fixed. All Scientific Proof Modules Added. -# ============================================================================== - # --- VISUAL INTERFACE COLORS --- class Colors: HEADER = '\033[95m' @@ -27,10 +19,30 @@ class Colors: GOLD = '\033[33m' PURPLE = '\033[35m' +try: + import pandas as pd + import numpy as np + from scipy import stats +except ImportError as e: + print(f"{Colors.FAIL}ERROR: Missing required scientific libraries.{Colors.ENDC}") + print(f"{Colors.WARNING}Please install the following dependencies:{Colors.ENDC}") + print(f" - pandas") + print(f" - numpy") + print(f" - scipy") + print(f"\nCommand: {Colors.CYAN}pip install pandas numpy scipy{Colors.ENDC}") + sys.exit(1) + +# ============================================================================== +# SIMULE3: V.135 - OMEGA VERIFICATION ARCHIVE (PROVEN FULL VERSION) +# STATUS: NameError Fixed. All Scientific Proof Modules Added. +# ============================================================================== + def loading_bar(desc): - print(f"{Colors.CYAN}{desc}...{Colors.ENDC}") - time.sleep(0.01) - print(f"{Colors.GREEN}[OK]{Colors.ENDC}") + sys.stdout.write(f"\r{Colors.CYAN}{desc}...{Colors.ENDC}") + sys.stdout.flush() + time.sleep(0.1) + sys.stdout.write(f"\r{Colors.CYAN}{desc}... {Colors.GREEN}[OK]{Colors.ENDC}\n") + sys.stdout.flush() pd.set_option('display.max_columns', None) pd.set_option('display.width', 1000) @@ -1329,6 +1341,15 @@ def __init__(self): def run_all(self): # First run the original flow (V.103) + ascii_banner = r""" + _____ _____ __ __ _ _ _ ______ ____ + / ____|_ _| \/ | | | | | | ____|___ \ + | (___ | | | \ / | | | | | | |__ __) | + \___ \ | | | |\/| | | | | | | __| |__ < + ____) |_| |_| | | | |__| | |____| |____ ___) | + |_____/|_____|_| |_|\____/|______|______|____/ +""" + print(f"{Colors.PURPLE}{ascii_banner}{Colors.ENDC}") print(f"{Colors.BOLD}{Colors.CYAN}SIMULE3 V.103 ULTIMATE STARTING...{Colors.ENDC}\n") self.mikro.metre(1) self.enlem_boylam.hatay_analiz() diff --git a/test_simulasyon_ux.py b/test_simulasyon_ux.py new file mode 100644 index 00000000..b491e9dc --- /dev/null +++ b/test_simulasyon_ux.py @@ -0,0 +1,39 @@ +import sys +import unittest +from unittest.mock import MagicMock + +# Mock heavy dependencies before importing the module +sys.modules["pandas"] = MagicMock() +sys.modules["numpy"] = MagicMock() +sys.modules["scipy"] = MagicMock() +sys.modules["scipy.stats"] = MagicMock() + +# Now import the module +import simulasyon_11 + +class TestUX(unittest.TestCase): + def test_loading_bar(self): + """Test that loading_bar uses \r and flushes stdout.""" + with unittest.mock.patch('sys.stdout', new_callable=unittest.mock.MagicMock) as mock_stdout: + simulasyon_11.loading_bar("Test") + + # Verify calls + calls = mock_stdout.write.call_args_list + # Should have at least two writes: "Test..." and "Test... [OK]\n" + # And specific format + self.assertTrue(any("Test..." in str(c) for c in calls)) + self.assertTrue(any("[OK]" in str(c) for c in calls)) + + # Verify flush was called + self.assertTrue(mock_stdout.flush.called) + + def test_instantiation(self): + """Test that Simule3_Lab_V133 can be instantiated.""" + try: + lab = simulasyon_11.Simule3_Lab_V133() + self.assertIsInstance(lab, simulasyon_11.Simule3_Lab_V133) + except Exception as e: + self.fail(f"Instantiation failed: {e}") + +if __name__ == "__main__": + unittest.main()