Example #1
0
def test_translate(target, value):
    t = translate(value, target)
    assert isinstance(t, target)
Example #2
0
def test_translate_error(target, value, exc):
    with pytest.raises(exc):
        translate(value, target)
Example #3
0
def test_translate_literal():
    with pytest.raises(TypeError):
        translate(1, Literal[1])
    with pytest.raises(TypeError):
        resolver.translator.factory(resolver.annotation(int), Literal[1])