def test_json_deserialization(s, transition): objects = [ Direction.CAUSE, s.network, # Network s, # Subsystem models.Bipartition(models.Part((0, ), ()), models.Part((1, ), (2, 3))), models.KPartition(models.Part((0, ), ()), models.Part((1, ), (2, 3))), models.Tripartition(models.Part((0, ), ()), models.Part((1, ), (2, 3)), models.Part((3, ), (4, ))), models.Cut((0, ), (2, )), models.NullCut((0, 1)), models.KCut( Direction.CAUSE, models.KPartition(models.Part((0, ), ()), models.Part((1, ), (2, 3)))), s.concept((1, 2)), s.concept((1, )), compute.ces(s), compute.sia(s), transition, transition.find_actual_cause((0, ), (0, )), actual.account(transition), actual.sia(transition) ] for o in objects: loaded = jsonify.loads(jsonify.dumps(o)) assert loaded == o
def test_cuts_can_have_node_labels(node_labels): models.NullCut((0, 1), node_labels=node_labels) models.Cut((0, ), (1, ), node_labels=node_labels) k_partition = models.KPartition(models.Part((0, 1), (0, )), models.Part((), (1, )), node_labels=node_labels) models.KCut(Direction.CAUSE, k_partition, node_labels=node_labels)