def test_registry():
    with pytest.raises(ValueError):
        registry(RtsFormatter)
    with pytest.raises(ValueError):
        registry(BaseFormatter)
    with pytest.raises(KeyError):
        registry.get(1)
Beispiel #2
0
def test_registry():
    with pytest.raises(ValueError):
        r(RtsFormatter)
    with pytest.raises(ValueError):
        registry(BaseFormatter)
    with pytest.raises(KeyError):
        registry.get(1)
    assert RtsFormatter.name not in registry
    assert RtsFormatter.name in r
def test_chain():
    f = registry.get(['str', 'rts'])
    a = '1'
    assert f.encode(a) == a
    assert f.decode(a) == a
def test_formatters(formatter, data):
    f = registry.get(formatter)
    enc = f.encode(data)
    assert isinstance(enc, bytes)
    assert f.decode(enc) == data