docs/lang: capture and verify an expected warning in doctest.
This commit is contained in:
parent
7639e84af4
commit
a127167c53
|
@ -1,3 +1,8 @@
|
||||||
|
.. testsetup::
|
||||||
|
|
||||||
|
# Required to capture warnings in doctests.
|
||||||
|
import sys; sys.stderr = sys.stdout
|
||||||
|
|
||||||
Language guide
|
Language guide
|
||||||
##############
|
##############
|
||||||
|
|
||||||
|
@ -170,6 +175,8 @@ Specifying a shape with a range is convenient for counters, indexes, and all oth
|
||||||
.. doctest::
|
.. doctest::
|
||||||
|
|
||||||
>>> fencepost = C(256, range(256))
|
>>> fencepost = C(256, range(256))
|
||||||
|
<...>:1: SyntaxWarning: Value 256 equals the non-inclusive end of the constant shape range(0, 256); this is likely an off-by-one error
|
||||||
|
fencepost = C(256, range(256))
|
||||||
>>> fencepost.shape()
|
>>> fencepost.shape()
|
||||||
unsigned(8)
|
unsigned(8)
|
||||||
>>> fencepost.value
|
>>> fencepost.value
|
||||||
|
|
Loading…
Reference in a new issue