From 1ade50d71b47a0b701a5134d1a0364a42ec1ee68 Mon Sep 17 00:00:00 2001 From: Bo Marchman Date: Tue, 20 Feb 2018 11:21:12 -0500 Subject: [PATCH] Test error handling --- pyphi/subsystem.py | 2 +- test/test_subsystem_cause_effect_repertoire.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyphi/subsystem.py b/pyphi/subsystem.py index baaf675d3..57d8356f8 100644 --- a/pyphi/subsystem.py +++ b/pyphi/subsystem.py @@ -395,7 +395,7 @@ def repertoire(self, direction, mechanism, purview): return self.cause_repertoire(mechanism, purview) elif direction == Direction.EFFECT: return self.effect_repertoire(mechanism, purview) - # TODO: test that ValueError is raised + return validate.direction(direction) def unconstrained_repertoire(self, direction, purview): diff --git a/test/test_subsystem_cause_effect_repertoire.py b/test/test_subsystem_cause_effect_repertoire.py index 3634c50a0..d33b41038 100644 --- a/test/test_subsystem_cause_effect_repertoire.py +++ b/test/test_subsystem_cause_effect_repertoire.py @@ -6,7 +6,7 @@ import pytest import example_networks -from pyphi import Subsystem +from pyphi import Direction, Subsystem from pyphi.models import Cut # Get example networks @@ -356,4 +356,8 @@ def test_cause_and_effect_repertoire(function, subsystem, mechanism, purview, assert np.array_equal(result, expected) +def test_repertoire_wrong_direction_error(s): + with pytest.raises(ValueError): + s.repertoire(Direction.BIDIRECTIONAL, (0,), (0, 1)) + # vim: set foldmarker={{{,}}} foldlevel=0 foldmethod=marker :