"""Smoke test: verify all 11 engines import and run on tiny synthetic data.""" import sys, os sys.path.insert(0, os.path.dirname(__file__)) import numpy as np # Generate tiny synthetic data np.random.seed(42) d, n = 20, 50 X = np.random.randn(n, d) errors = [] total = 0 passed = 0 def test_engine(name, data, **kwargs): global total, passed total += 1 try: import causalscale as cs model = cs.CausalDiscovery(data, method=name, **kwargs) model.fit(verbose=False) net = model.get_network() print(f" [OK] {name}: {net.edge_count} edges, {net.time_s:.1f}s") passed += 1 return True except Exception as e: print(f" [FAIL] {name}: {str(e)[:120]}") errors.append((name, str(e))) return False print("=== causalscale v3.3.0 Smoke Tests ===\n") # Core engines test_engine("dagma", X) test_engine("cluster_aware", X) test_engine("transformer", X) test_engine("lowrank", X) # Specialized engines test_engine("multibatch", X, extra_data=[X + 0.1 * np.random.randn(n, d)]) test_engine("llm_prior", X) test_engine("bayes_lowrank", X, n_bootstrap=5) test_engine("sc_causal", X) test_engine("ensemble", X) test_engine("multimodal", X, extra_data=[X + 0.1 * np.random.randn(n, d)]) # Auto test_engine("auto", X) print(f"\n=== Results: {passed}/{total} passed ===") if errors: print("\nFailures:") for name, err in errors: print(f" {name}: {err[:200]}") sys.exit(0 if passed == total else 1)