""" Tests de validation - Fiche #1 : Exports WindowContext sans collision Auteur: Dom, Alice Kiro - 15 décembre 2024 """ import pytest from core.models import RawWindowContext, WindowContext, ScreenWindowContext def test_window_context_no_collision(): """Test que les imports WindowContext ne sont plus ambigus""" # WindowContext doit pointer vers RawWindowContext (compatibilité layer 0) assert WindowContext is RawWindowContext # ScreenWindowContext doit être distinct (layer 1) assert ScreenWindowContext is not WindowContext # Vérifier qu'on peut créer les deux types raw_ctx = RawWindowContext(title="Test", app_name="TestApp") screen_ctx = ScreenWindowContext( app_name="TestApp", window_title="Test", screen_resolution=[1920, 1080] ) assert raw_ctx.title == "Test" assert screen_ctx.window_title == "Test" def test_backward_compatibility(): """Test que l'alias WindowContext fonctionne pour le code legacy""" # Le code legacy qui faisait from core.models import WindowContext # doit continuer à fonctionner ctx = WindowContext(title="Legacy", app_name="LegacyApp") assert ctx.title == "Legacy" assert ctx.app_name == "LegacyApp" if __name__ == "__main__": pytest.main([__file__, "-v"])