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