def test_matching():
    """Test selector stream matching."""

    sel = DataStreamSelector.FromString(u'all system buffered')
    assert sel.matches(DataStream.FromString('system buffered 1'))
    assert not sel.matches(DataStream.FromString('buffered 1'))
    assert not sel.matches(DataStream.FromString('counter 1'))

    sel = DataStreamSelector.FromString(u'all user outputs')
    assert sel.matches(DataStream.FromString('output 1'))
    assert not sel.matches(DataStream.FromString('system output 1'))
    assert not sel.matches(DataStream.FromString('counter 1'))

    sel = DataStreamSelector.FromString(u'all combined outputs')
    assert sel.matches(DataStream.FromString('output 1'))
    assert sel.matches(DataStream.FromString('system output 1'))
    assert not sel.matches(DataStream.FromString('counter 1'))

    sel = DataStreamSelector.FromString(u'all outputs')
    assert sel.matches(DataStream.FromString('output 1'))
    assert sel.matches(DataStream.FromString('system output 1024'))
    assert not sel.matches(DataStream.FromString('system output 1'))
    assert not sel.matches(DataStream.FromString('counter 1'))