Skip to content

Commit a127167

Browse files
committed
docs/lang: capture and verify an expected warning in doctest.
1 parent 7639e84 commit a127167

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/lang.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.. testsetup::
2+
3+
# Required to capture warnings in doctests.
4+
import sys; sys.stderr = sys.stdout
5+
16
Language guide
27
##############
38

@@ -170,6 +175,8 @@ Specifying a shape with a range is convenient for counters, indexes, and all oth
170175
.. doctest::
171176

172177
>>> fencepost = C(256, range(256))
178+
<...>:1: SyntaxWarning: Value 256 equals the non-inclusive end of the constant shape range(0, 256); this is likely an off-by-one error
179+
fencepost = C(256, range(256))
173180
>>> fencepost.shape()
174181
unsigned(8)
175182
>>> fencepost.value

0 commit comments

Comments
 (0)