Esempio n. 1
0
def test_translate(target, value):
    t = translate(value, target)
    assert isinstance(t, target)
Esempio n. 2
0
def test_translate_error(target, value, exc):
    with pytest.raises(exc):
        translate(value, target)
Esempio n. 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])