def test_keyspace_collision(self):
        """Test that if both the source and spec provide a keyspace an error is
        raised.
        """
        a_spec = spec(None, keyspace=mock.Mock())
        b_spec = spec(None, keyspace=mock.Mock())

        # Make the signal parameters, this should raise an error
        with pytest.raises(NotImplementedError):
            _make_signal_parameters(a_spec, b_spec, DummyConnection())
Example #2
0
    def test_keyspace_collision(self):
        """Test that if both the source and spec provide a keyspace an error is
        raised.
        """
        a_spec = spec(None, keyspace=mock.Mock())
        b_spec = spec(None, keyspace=mock.Mock())

        # Make the signal parameters, this should raise an error
        with pytest.raises(NotImplementedError):
            _make_signal_parameters(a_spec, b_spec, DummyConnection())
    def test_latching(self, a_is_latching, b_is_latching, latching):
        # Construct the specs
        a_spec = spec(None, latching=a_is_latching)
        b_spec = spec(None, latching=b_is_latching)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.latching is latching
Example #4
0
    def test_latching(self, a_is_latching, b_is_latching, latching):
        # Construct the specs
        a_spec = spec(None, latching=a_is_latching)
        b_spec = spec(None, latching=b_is_latching)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.latching is latching
    def test_keyspace_from_sink(self):
        """Check that the sink keyspace is used if provided."""
        ks = mock.Mock(name="Keyspace")
        a_spec = spec(None)
        b_spec = spec(None, keyspace=ks)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.keyspace is ks
    def test_weight(self, source_weight, sink_weight):
        """Test that the greatest specified weight is used."""
        # Construct the specs
        a_spec = spec(None, weight=source_weight)
        b_spec = spec(None, weight=sink_weight)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.weight == max((source_weight, sink_weight))
Example #7
0
    def test_keyspace_from_sink(self):
        """Check that the sink keyspace is used if provided."""
        ks = mock.Mock(name="Keyspace")
        a_spec = spec(None)
        b_spec = spec(None, keyspace=ks)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.keyspace is ks
Example #8
0
    def test_weight(self, source_weight, sink_weight):
        """Test that the greatest specified weight is used."""
        # Construct the specs
        a_spec = spec(None, weight=source_weight)
        b_spec = spec(None, weight=sink_weight)

        # Make the signal parameters, check they are correct
        sig_pars = _make_signal_parameters(a_spec, b_spec, DummyConnection())
        assert sig_pars.weight == max((source_weight, sink_weight))