Commit 1434b42
committed
docs: broken code blocks in docs/source/async.rst; add Manuel tests for them
The three runnable code blocks in docs/source/async.rst were broken:
1. `async with aio.get_async_davclient() as client:` fails with
"coroutine object does not support the asynchronous context manager
protocol" because get_async_davclient is an async function and must
be awaited before it can be used as a context manager. Fixed to
`async with await aio.get_async_davclient() as client:`.
Same bug was present in the Quick Start, the "Working with Calendars",
and the "Parallel Operations" examples, and in the Migration section.
2. `cal.name` triggers a DeprecationWarning (use get_display_name()
instead); replaced with `await cal.get_display_name()` in the two
code blocks that used it.
The three runnable code blocks are now covered by the existing Manuel-
based test harness: added `test_async_ref = manueltest(...)` to
tests/test_docs.py (also fixed the double-assignment bug that made
test_async_tutorial silently shadow test_tutorial). Confirmed tests
fail before fix and pass after.
Fixes: #661
prompt: Why is the "quick start" in docs/source/async.rst failing?
followup-prompt: We need the code blocks in the documentation to be exercised by test code whenever possible. We already have some tests covering the tutorial. See if it's possible to get the code blocks that was changed just now tested. Revert the docfixes to verify that the tests are working correctly. Docfixes plus tests should be in the same commit, and remember to add prompts to the commit message.
followup-prompt: Add a reference to #661 in the commit message1 parent 9515bae commit 1434b42
2 files changed
Lines changed: 18 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
12 | 22 | | |
13 | 23 | | |
14 | 24 | | |
| |||
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | | - | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
27 | | - | |
| 37 | + | |
28 | 38 | | |
29 | 39 | | |
30 | 40 | | |
| |||
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
75 | | - | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
115 | | - | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| |||
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
124 | | - | |
| 134 | + | |
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
| |||
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
153 | | - | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
0 commit comments