Ejemplo n.º 1
0
 def f(x: bool):
     return Type.template_member(
         Type('int'),
         '1abc',  # error: The second argument passed to Type.template_member should be a valid C\+\+ identifier
         [])
Ejemplo n.º 2
0
 def f(x: bool):
     return Type.template_member(
         Type('int'), 'foo', 15
     )  # error: The third argument passed to Type.template_member should have type List\[Type\], but was: int
Ejemplo n.º 3
0
 def f(x: bool):
     return Type.template_member(
         4,  # error: The first argument passed to Type.template_member should have type Type, but was: int
         'foo',
         [])
Ejemplo n.º 4
0
 def f(x: bool):
     return Type.template_member(
         Type('int'),
         15,  # error: The second argument passed to Type.template_member should be a string
         [])
Ejemplo n.º 5
0
 def f(x: bool):
     return Type.template_member(
         Type('int'), 'foo', 'bar',
         'baz')  # error: Type.template_member\(\) takes 3 arguments. Got: 4
Ejemplo n.º 6
0
 def f(x: bool):
     return Type.template_member(
         Type('int')
     )  # error: Type.template_member\(\) takes 3 arguments. Got: 1
Ejemplo n.º 7
0
 def f(x: bool):
     return Type.template_member(
         type=Type('int')
     )  # error: Keyword arguments are not supported in Type.template_member\(\)
Ejemplo n.º 8
0
def test_template_member_literal_success():
    from tmppy import Type
    assert Type.pointer(Type('float')) == Type.template_member(
        Type('Holder'), 'Inner', [Type('int'), Type('float')]).type
Ejemplo n.º 9
0
 def f(x: Type):
     return match(x)(
         lambda: {
             Type.template_member():  # error: Type.template_member\(\) is not allowed in match patterns
             x,
         })