Ejemplo n.º 1
0
def test_validate_layered_boxed_types(fx_layered_boxed_types):
    A, B, C = fx_layered_boxed_types
    assert validate_unboxed_type(u'test', text_type)
    assert validate_unboxed_type(A(u'test'), A)
    assert validate_unboxed_type(B(A(u'test')), B)
    with raises(TypeError):
        assert validate_unboxed_type(u'test', A)

    with raises(TypeError):
        assert validate_unboxed_type(u'test', B)

    with raises(TypeError):
        assert validate_unboxed_type(A(u'test'), B)
Ejemplo n.º 2
0
def test_validate_unboxed_type():
    assert validate_unboxed_type(3.14, float)
    with raises(TypeError):
        validate_unboxed_type(u'hello', float)
Ejemplo n.º 3
0
 def __init__(self, value):
     validate_unboxed_type(value, B)
     self.value = value  # type: B
Ejemplo n.º 4
0
 def __init__(self, value):
     validate_unboxed_type(value, uuid.UUID)
     self.value = value
Ejemplo n.º 5
0
 def __init__(self, value):
     validate_unboxed_type(value, text_type)
     self.value = value  # type: Text