# Split Miner - BPMN process discovery from event logs. # Authors: # imacat@mail.imacat.idv.tw (imacat), 2026/3/10 # AI assistance: Claude Code (Anthropic) # Copyright (c) 2026 imacat. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. """Tests for empty and minimal event logs. Verifies proper error handling when input data is insufficient for the Split Miner pipeline. """ from __future__ import annotations import unittest from split_miner import split_miner from split_miner.bpmn import Node, Task from split_miner.dfg import DirectlyFollowsGraph class TestEmptyLog(unittest.TestCase): """Tests for empty event log handling.""" def test_empty_log_dfg(self) -> None: """Empty log produces a DFG with no nodes.""" dfg: DirectlyFollowsGraph = ( DirectlyFollowsGraph({}) ) self.assertEqual(dfg.nodes, set()) self.assertEqual(dfg.edges, set()) def test_empty_log_no_sources(self) -> None: """Empty DFG has no sources.""" dfg: DirectlyFollowsGraph = ( DirectlyFollowsGraph({}) ) self.assertEqual(dfg.sources, set()) def test_empty_log_split_miner(self) -> None: """Split Miner handles empty log gracefully.""" model = split_miner({}) self.assertEqual(len(model.edges), 0) def test_single_event_trace(self) -> None: """Single-event trace produces no edges.""" a: Task = Task("a", "a") dfg: DirectlyFollowsGraph = ( DirectlyFollowsGraph({(a,): 1}) ) self.assertEqual(dfg.nodes, {a}) self.assertEqual(dfg.edges, set()) if __name__ == "__main__": unittest.main()