Beispiel #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
         [])
Beispiel #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
Beispiel #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',
         [])
Beispiel #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
         [])
Beispiel #5
0
 def f(x: bool):
     return Type.template_member(
         Type('int'), 'foo', 'bar',
         'baz')  # error: Type.template_member\(\) takes 3 arguments. Got: 4
Beispiel #6
0
 def f(x: bool):
     return Type.template_member(
         Type('int')
     )  # error: Type.template_member\(\) takes 3 arguments. Got: 1
Beispiel #7
0
 def f(x: bool):
     return Type.template_member(
         type=Type('int')
     )  # error: Keyword arguments are not supported in Type.template_member\(\)
Beispiel #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
Beispiel #9
0
 def f(x: Type):
     return match(x)(
         lambda: {
             Type.template_member():  # error: Type.template_member\(\) is not allowed in match patterns
             x,
         })