-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.py
83 lines (50 loc) · 1.36 KB
/
tests.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from doctools import (append_to_docs, append_var_to_docs,
include_docs_from, _getindent)
def test_append_to_docs():
def foo():
"""some
multiline
docstring"""
pass
append_to_docs(foo, 'more random docs')
assert foo.__doc__ == """some
multiline
docstring
more random docs"""
def test_append_to_docs_undocumented():
def foo():
pass
append_to_docs(foo, 'some documentation')
assert foo.__doc__ == 'some documentation'
def test_append_var_to_docs():
def foo():
"""some
docstring"""
pass
append_var_to_docs(foo, 'My Var', [1, 2, 3, 4])
assert foo.__doc__ == """some
docstring
My Var:
[1, 2, 3, 4]"""
def test_getindent():
assert _getindent("""Foo
bar
baz""") == 12
def test_getindent():
assert _getindent("foo") == 0
def test_getindent_multiline_no_default_indent():
assert _getindent("foo\nbar\n baz") == 0
def test_include_docs_from():
def foo():
"""foo docs."""
@include_docs_from(foo)
def bar():
"""bar docs."""
assert bar.__doc__ == 'bar docs.\n\nfoo docs.'
def test_include_docs_from_undocumented():
def foo():
pass
@include_docs_from(foo)
def bar():
"""bar docs."""
assert bar.__doc__ == 'bar docs.'