Skip to content

Commit 7052500

Browse files
committed
improved location of sanity check for PTAs
1 parent 99f0549 commit 7052500

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aalpy/learning_algs/general_passive/GsmNode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ def detect_data_format(data, check_consistency=False, guess=False):
6464
# - "traces": [[o, o, ...], ...]
6565

6666
if isinstance(data, GsmNode):
67-
if not data.is_tree():
68-
raise ValueError("provided automaton is not a tree")
6967
return "tree"
7068

7169
accepted_types = (Tuple, List)
@@ -432,6 +430,8 @@ def createPTA(data, output_behavior, data_format=None) -> 'GsmNode':
432430
raise ValueError(f"invalid data format {data_format}. should be in {DataFormatRange}")
433431

434432
if data_format == "tree":
433+
if not data.is_tree():
434+
raise ValueError("provided automaton is not a tree")
435435
return data
436436
root_node = GsmNode((None, unknown_output), None)
437437
if data_format == "labeled_sequences":

0 commit comments

Comments
 (0)