From a127167c533aaa9f917f16c2df8b60191f6a2c4e Mon Sep 17 00:00:00 2001 From: Catherine Date: Mon, 24 Jul 2023 13:39:56 +0000 Subject: [PATCH] docs/lang: capture and verify an expected warning in doctest. --- docs/lang.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/lang.rst b/docs/lang.rst index cc22baf..6a1c110 100644 --- a/docs/lang.rst +++ b/docs/lang.rst @@ -1,3 +1,8 @@ +.. testsetup:: + + # Required to capture warnings in doctests. + import sys; sys.stderr = sys.stdout + Language guide ############## @@ -170,6 +175,8 @@ Specifying a shape with a range is convenient for counters, indexes, and all oth .. doctest:: >>> 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() unsigned(8) >>> fencepost.value