Test loading existing example files.
(self)
| 107 | self.assertEqual(len(self.graph.connections), 4) |
| 108 | |
| 109 | def test_example_file_loading(self): |
| 110 | """Test loading existing example files.""" |
| 111 | examples_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "examples") |
| 112 | |
| 113 | if os.path.exists(examples_dir): |
| 114 | example_files = [f for f in os.listdir(examples_dir) if f.endswith('.md')] |
| 115 | |
| 116 | for example_file in example_files[:2]: # Test first 2 files only |
| 117 | file_path = os.path.join(examples_dir, example_file) |
| 118 | |
| 119 | try: |
| 120 | # Import dynamically to avoid circular import |
| 121 | from data.flow_format import load_flow_file |
| 122 | data = load_flow_file(file_path) |
| 123 | self.assertIn("nodes", data) |
| 124 | |
| 125 | # Try to load into graph |
| 126 | test_graph = NodeGraph() |
| 127 | test_graph.deserialize(data) |
| 128 | |
| 129 | # Should have created some nodes |
| 130 | self.assertGreaterEqual(len(test_graph.nodes), 0) |
| 131 | |
| 132 | except Exception as e: |
| 133 | self.fail(f"Failed to load {example_file}: {e}") |
| 134 | |
| 135 | def test_error_recovery(self): |
| 136 | """Test system recovery from various error conditions.""" |
nothing calls this directly
no test coverage detected