def test_add_on_condition(self):
        # Signature: name(self, on_condition)
                # Add an OnCondition transition which leaves this regime
                #
                # If the on_condition object has not had its target regime name
                # set in the constructor, or by calling its ``set_target_regime_name()``,
                # then the target is assumed to be this regime, and will be set
                # appropriately.
                #
                # The source regime for this transition will be set as this regime.
        from nineml.abstraction_layer import Regime
        from nineml.abstraction_layer import OnCondition, OnEvent
        from nineml.exceptions import NineMLRuntimeError

        r = Regime(name='R1')
        self.assertEquals(set(r.on_conditions), set())
        self.assertRaises(NineMLRuntimeError, r.add_on_condition, OnEvent('sp1'))
        r.add_on_condition(OnCondition('sp1>0'))
        self.assertEquals(len(set(r.on_conditions)), 1)
        self.assertEquals(len(set(r.on_events)), 0)
        self.assertEquals(len(set(r.transitions)), 1)