/ test_mindvirus_infection.py
test_mindvirus_infection.py
1 """Test MindVirusInfection scene with partial generator_mode support""" 2 # Completely purge DreamTalk modules from cache before reimporting 3 import sys 4 modules_to_delete = [key for key in sys.modules.keys() if 'DreamTalk' in key] 5 for mod in modules_to_delete: 6 del sys.modules[mod] 7 8 from pathlib import Path 9 10 # Bootstrap paths for all submodules 11 _submodules = Path(__file__).resolve().parent.parent / 'MindVirusInfection' / 'submodules' 12 sys.path.insert(0, str(_submodules)) 13 14 from DreamTalk.imports import * 15 16 # Import sovereign symbol modules 17 import importlib.util 18 19 def load_dreamnode(name): 20 """Load a DreamNode's main class from submodules.""" 21 spec = importlib.util.spec_from_file_location( 22 name, 23 _submodules / name / f"{name}.py" 24 ) 25 module = importlib.util.module_from_spec(spec) 26 spec.loader.exec_module(module) 27 return getattr(module, name) 28 29 HumanMind = load_dreamnode("HumanMind") 30 MindVirus = load_dreamnode("MindVirus") 31 32 33 class TestScene(ThreeDScene): 34 def __init__(self): 35 # Test with generator_mode for camera 36 super().__init__(sketch_mode=True, generator_mode=True) 37 38 def construct(self): 39 # Simple test - just create the objects without full animation 40 human = HumanMind(scale=1.0) 41 42 # Cable anchor point 43 cable_anchor = Null(z=800, name="CableOrigin") 44 45 virus = MindVirus( 46 color=BLUE, 47 cable=True, 48 cable_origin=cable_anchor, 49 cable_radius=4, 50 cable_color=WHITE, 51 stroke_width=3, 52 z=400, # Start behind 53 scale=0.6, 54 generator_mode=True, # Test generator mode 55 name="MindVirus" 56 ) 57 58 print(f"Camera type: {self.camera.obj.GetTypeName()}") 59 print(f"Camera is generator: {self.camera.obj.GetType() == 1023866}") 60 61 # Check if virus.cube has generator_mode 62 print(f"Virus cube type: {virus.cube.obj.GetTypeName()}") 63 print(f"Virus cube is generator: {virus.cube.obj.GetType() == 1023866}") 64 print(f"Virus has fold_parameter: {hasattr(virus, 'fold_parameter')}") 65 print(f"Virus generator_mode: {virus.generator_mode}") 66 67 if __name__ == "__main__": 68 scene = TestScene()