from contracts import contract contract def test data type data timede

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
>>> from contracts import contract
>>> @contract
... def test(data):
... """
... :type data: timedelta
... """
...
...
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/__init__.py", line 20, in contract
return contract_decorator(*args, **kwargs)
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/main.py", line 167, in contract_decorator
raise ContractSyntaxError(e.error, e.where)
ContractSyntaxError: Unknown identifier 'timedelta'. Did you mean 'AntiFraudGreylistData'? (at char 0), (line:1, col:1)
line 1 >timedelta
^
|
here or nearby
>>> @contract
... def test(data):
... """
... :tipe data: timedelta
... """
...
...
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/__init__.py", line 20, in contract
return contract_decorator(*args, **kwargs)
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/main.py", line 164, in contract_decorator
return contracts_decorate(function, **kwargs)
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/main.py", line 254, in contracts_decorate
raise ContractException('No contract specified in docstring.')
ContractException: No contract specified in docstring.
>>> @contract
... def test(data=None):
... """
... :tipe data: timedelta
... """
...
...
Traceback (most recent call last):
File "<input>", line 2, in <module>
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/__init__.py", line 20, in contract
return contract_decorator(*args, **kwargs)
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/main.py", line 164, in contract_decorator
return contracts_decorate(function, **kwargs)
File "/Users/bstar/.pyenv/versions/ostrota/lib/python2.7/site-packages/contracts/main.py", line 254, in contracts_decorate
raise ContractException('No contract specified in docstring.')
ContractException: No contract specified in docstring.
>>> @contract
... def test(arg_one, data=None):
... """
... :type arg_one: bool
... :tipe data: bool
... """
...